Add a config for enforcing a minimum job reserve interval (default: 0 for now) #48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is related to #41 and #42 insofar as a kind of DB-bound "spinloop" is still possible if a worker picks up jobs that take so little time that the worker immediately turns around and asks for more. As of now, there has been no way to tune the amount of time a worker should wait in between successful iterations of its run loop.
This introduces a configuration (
min_reserve_interval
) specifying a minimum number of seconds (default: 0 as this is not a major release) that a worker should wait in between successful job reserve queries. An existing config (sleep_delay
) is still used to define the number of seconds (default: 5) that a worker should wait in between unsuccessful job reserve attempts (i.e. the queue is empty).The job execution time is subtracted from
min_reserve_interval
when the worker sleeps, and if jobs take more thanmin_reserve_interval
to complete than the worker will not sleep before the next reserve query./no-platform