Fixed some logic around queue task pickup#56
Merged
Conversation
|
Coverage for this change: 12.1% |
Contributor
There was a problem hiding this comment.
Pull request overview
Improves the queue task pickup loop in Manager.Run so the scheduler is prompted to re-check the queue soon when at least one task was picked up during a pass, helping the queue drain more efficiently under capacity/retain constraints.
Changes:
- Track whether any queue tasks were picked up during the current pass.
- Return that signal to the scheduler when
NextTaskyields no retainable task, enabling a quicker subsequent check.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+86
to
88
| processed := false | ||
| for i := 0; i < runtime.GOMAXPROCS(0); i++ { | ||
| // Get next task for the queue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 pull request makes a small but important change to the task processing loop in
pgqueue/manager/run.go. The update ensures that if at least one task was processed during a pass, the scheduler is prompted to check the queue again soon, helping to keep the queue draining efficiently.Task processing logic improvement:
Manager.Runmethod to track whether any tasks were processed in the current pass and return this information, allowing the scheduler to make better decisions about when to re-check the queue. [1] [2]