Repository navigation
Forward chord body routing options to chord_unlock - #10442
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10442 +/- ##
==========================================
+ Coverage 88.86% 88.87% +0.01%
==========================================
Files 153 153
Lines 19986 20006 +20
Branches 2336 2342 +6
==========================================
+ Hits 17760 17780 +20
Misses 1929 1929
Partials 297 297
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
There was a problem hiding this comment.
Pull request overview
This PR fixes chord unlock routing for non-default AMQP routing setups (notably headers exchanges) by forwarding relevant routing options from the chord body signature into the internally-published celery.chord_unlock task, preventing the unlock message from missing bindings and being dropped.
Changes:
- Forward
exchange,exchange_type,routing_key, andheadersfrom the chord body’sSignature.optionsintofallback_chord_unlock()’sapply_async()call. - Skip forwarding any of those options if they are listed in the body’s
stamped_headers(so stamping semantics aren’t accidentally treated as transport routing). - Add unit coverage asserting routing options are forwarded (and stamped routing options are not).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
celery/backends/base.py |
Extends fallback_chord_unlock() to forward additional routing-related apply_async options from the chord body, enabling headers exchange routing to work. |
t/unit/backends/test_base.py |
Adds tests verifying routing options are forwarded to celery.chord_unlock and that stamped routing options are excluded. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
auvipy
left a comment
There was a problem hiding this comment.
can we also add integration test for this? may be we got a reproducing script attached in the script
I added a smoke test for this. |
|
@goingforstudying-ctrl can you try and review this please? since you recently handle a canvas based issue |
goingforstudying-ctrl
left a comment
There was a problem hiding this comment.
I reviewed all four changed files and cross-checked the routing path through fallback_chord_unlock(), Task.retry(), the router, and Kombu publishing.
I also validated the current head against RabbitMQ with a deliberately slow header task and a 1-second chord retry interval. The unlock task retried repeatedly and the callback completed successfully. The routing-option forwarding and stamped-option filtering look correct for the reported headers-exchange case.
Non-blocking: it would still be useful to make the smoke test deterministically exercise at least one retry, so that behavior is protected explicitly.
LGTM.
cc33a49 to
ca6c552
Compare
Description
Closes: #6690
fallback_chord_unlock()forwards onlyqueueandpriorityfrom the chord body's options when publishingcelery.chord_unlock. Aheadersexchange routes on the message headers, so thecelery.chord_unlockmatches no binding and is discarded.This PR also forwards
exchange,exchange_type,routing_keyandheadersfrom the body's options, skipping any of them that is a stamp.