Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move timeout context into slot acquisition service #14121

Merged
merged 4 commits into from
Jun 20, 2024

Conversation

zzstoatzz
Copy link
Contributor

@zzstoatzz zzstoatzz commented Jun 18, 2024

this PR moves the timeout_async context down into the acquire_slots method of the ConcurrencySlotAcquisitionService to ensure its scoped correctly.

this has the bonus that we remove some duplication as _acquire_concurrency_slots is used by both the sync and asyncio versions of the concurrency context manager


if this looks good ill port it to 2.x

Comment on lines +105 to +109
if isinstance(response_or_exception, TimeoutError):
raise AcquireConcurrencySlotTimeoutError(
f"Attempt to acquire concurrency slots timed out after {timeout_seconds} second(s)"
) from response_or_exception

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raising a custom error here because the generic Scope timed out after ... message from timeout_async isnt so illuminating in this context

@zzstoatzz zzstoatzz self-assigned this Jun 18, 2024
@zzstoatzz zzstoatzz added the fix A fix for a bug in an existing feature label Jun 18, 2024
@zzstoatzz zzstoatzz marked this pull request as ready for review June 18, 2024 19:36
@zzstoatzz zzstoatzz requested a review from a team as a code owner June 18, 2024 19:36
Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@zzstoatzz zzstoatzz merged commit 4b3b4e1 into main Jun 20, 2024
28 checks passed
@zzstoatzz zzstoatzz deleted the fix-concurrency-timeout branch June 20, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug in an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants