Repository navigation
packages/django-dramatiq-postgres: reconcile pending tasks during continuous notifications - #26152
Merged
rissson merged 2 commits intoSep 23, 2026
Merged
Conversation
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #26152 +/- ##
==========================================
- Coverage 92.11% 92.08% -0.04%
==========================================
Files 1176 1176
Lines 76768 76793 +25
Branches 4121 4121
==========================================
- Hits 70716 70715 -1
- Misses 5999 6025 +26
Partials 53 53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
BeryJu
approved these changes
Sep 15, 2026
rissson
approved these changes
Sep 22, 2026
Member
|
@ryanpesek do you mind resolving the conflicts? and then we can get this in |
Contributor
Author
Done! |
Contributor
|
🍒 Cherry-pick to |
BeryJu
pushed a commit
that referenced
this pull request
Nov 23, 2026
…tinuous notifications (cherry-pick #26152 to version-2026.8) (#27999) packages/django-dramatiq-postgres: reconcile pending tasks during continuous notifications (#26152) Co-authored-by: Ryan Pesek <[email protected]>
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.
Details
What does this PR change?
Periodically reconcile runnable tasks from PostgreSQL into the consumer's pending set, even while PostgreSQL notifications continue arriving.
Reconciliation uses the existing
consumer_listen_timeoutas its interval and does not run while the consumer has reached its prefetch limit.A regression test covers continuous stale notifications preventing a runnable task from being discovered.
Why is this change needed?
PostgreSQL
NOTIFYmessages are delivered to every worker. In deployments where workers have different database latency, a lower-latency worker can claim and complete tasks before a higher-latency worker processes the corresponding notifications.The higher-latency worker then spends its time processing stale notification IDs. Because the broker only queried the task table when no notification was available, a continuous notification stream could prevent that fallback query indefinitely, leaving runnable tasks undiscovered by the worker.
This was reproduced with workers in two regions sharing a PostgreSQL database. Restarting the affected worker caused its startup scan to find the runnable backlog and immediately resume processing at full concurrency.
Checklist
make all)make docs)