Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces independent acknowledgment controls for task failures vs. timeouts, enabling workflows like “ack on failure for DLQ, but requeue on timeout” while preserving existing behavior via fallback to task_acks_on_failure_or_timeout and deprecating the old combined setting.
Changes:
- Add new config/task flags
task_acks_on_failureandtask_acks_on_timeout(defaultNone, fallback to the legacy combined flag). - Update worker request handling so
on_timeout()usesacks_on_timeoutandon_failure()usesacks_on_failure(oracks_on_timeoutforTimeLimitExceeded). - Extend unit tests and configuration docs to cover the new flags and deprecation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
celery/worker/request.py |
Switch timeout/failure ack/reject decisions to the new per-case flags. |
celery/app/task.py |
Add task attributes and binding-time fallback logic for the new flags. |
celery/app/defaults.py |
Add new configuration options and deprecation metadata for the legacy flag. |
docs/userguide/configuration.rst |
Document the new settings and mark the old one deprecated. |
t/unit/worker/test_request.py |
Add/adjust tests to validate independent failure vs. timeout behavior. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10150 +/- ##
=======================================
Coverage 87.54% 87.55%
=======================================
Files 153 153
Lines 19413 19422 +9
Branches 2231 2234 +3
=======================================
+ Hits 16996 17005 +9
Misses 2121 2121
Partials 296 296
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Description
Fixes #10128
Currently
acks_on_failure_or_timeoutis a single boolean controlling ack behavior for both failure and timeout. There's no way to ack on failure (to send messages to a DLQ) but requeue on timeout.This splits it into two independent settings:
task_acks_on_failureandtask_acks_on_timeout. Both default toNone, falling back to the existingacks_on_failure_or_timeoutso current behavior is preserved. The old setting is marked deprecated.On the runtime side,
on_timeout()now checksacks_on_timeoutandon_failure()checksacks_on_failurefor regular exceptions oracks_on_timeoutforTimeLimitExceeded.