Skip to content

Defer _reset_cycle call until after updating _active_queue - #2553

Merged
auvipy merged 4 commits into
celery:mainfrom
soceanainn:fix-consumer-cancel-order
Jun 10, 2026
Merged

Defer _reset_cycle call until after updating _active_queue#2553
auvipy merged 4 commits into
celery:mainfrom
soceanainn:fix-consumer-cancel-order

Conversation

@soceanainn

Copy link
Copy Markdown
Contributor

_reset_cycle when called updates _cycle with a new FairCycle based on the value of active_queues.

This means we should call _reset_cycle after we remove the queue from _active_queues instead of before that.

@auvipy auvipy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this will also need proper tests

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.75%. Comparing base (0b293c7) to head (b3ea8f1).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2553   +/-   ##
=======================================
  Coverage   82.75%   82.75%           
=======================================
  Files          79       79           
  Lines       10261    10261           
  Branches     1174     1174           
=======================================
  Hits         8491     8491           
  Misses       1569     1569           
  Partials      201      201           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

This PR adjusts the virtual transport Channel.basic_cancel() flow so that _reset_cycle() rebuilds the FairCycle using the updated _active_queues list (after the queue is removed), matching how _reset_cycle() derives its resources.

Changes:

  • Moved the _reset_cycle() call in basic_cancel() to occur after _active_queues.remove(queue).
  • Updated the corresponding unit test to validate the intended ordering behavior around _active_queues updates and _reset_cycle().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
kombu/transport/virtual/base.py Defers _reset_cycle() until after _active_queues is updated during basic_cancel().
t/unit/transport/virtual/test_base.py Adjusts the unit test for basic_cancel() to check the new call ordering expectations.

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

Comment thread t/unit/transport/virtual/test_base.py Outdated
@auvipy auvipy added this to the 5.7.0 milestone Jun 6, 2026
@auvipy
auvipy merged commit 77a5dee into celery:main Jun 10, 2026
41 checks passed
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.

3 participants