Skip to content

Fixed some logic around queue task pickup#56

Merged
djthorpe merged 1 commit into
mainfrom
djt/0616/queue-tasks
Jun 16, 2026
Merged

Fixed some logic around queue task pickup#56
djthorpe merged 1 commit into
mainfrom
djt/0616/queue-tasks

Conversation

@djthorpe

Copy link
Copy Markdown
Member

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:

  • Modified the loop in the Manager.Run method 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]

@djthorpe djthorpe self-assigned this Jun 16, 2026
Copilot AI review requested due to automatic review settings June 16, 2026 10:03
@djthorpe djthorpe merged commit 396c95d into main Jun 16, 2026
1 check passed
@djthorpe djthorpe deleted the djt/0616/queue-tasks branch June 16, 2026 10:04
@github-actions

Copy link
Copy Markdown

Coverage for this change: 12.1%

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 NextTask yields no retainable task, enabling a quicker subsequent check.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pgqueue/manager/run.go
Comment on lines +86 to 88
processed := false
for i := 0; i < runtime.GOMAXPROCS(0); i++ {
// Get next task for the queue
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.

2 participants