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

fixing a bug with per-request timeout #11

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

tomreitz
Copy link
Collaborator

lightbeam send works by enqueueing requests (MAX_TASK_QUEUE_SIZE = 1000 at a time) and then asynchronously processing the queue using config.pool_size workers.

Previously, the per-request timeout "clock" started counting as soon as a request was enqueued, so it included all the time it waited in the queue for an available connection from the pool. If the queue size was large compared to pool_size and/or the Ed-Fi API was particularly slow, you could wind up in an infinite loop where the aiohttp.RetryClient would perpetually timeout and requeue tasks, so lightbeam would never finish.

This update changes the timeout behavior to measure time from when a request begins actually processing.

…k spends in the queue waiting for an available connection from the pool
@tomreitz tomreitz merged commit 1cd3933 into main Jun 13, 2023
@tomreitz tomreitz deleted the bugfix/connection_timeout_included_time_in_queue branch June 13, 2023 18:52
Copy link
Collaborator

@jayckaiser jayckaiser left a comment

Choose a reason for hiding this comment

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

Similar to the other PR, there's a couple layers of knowledge required to understand why the change was necessary, but the code-updates make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants