Fix: SQS polling_interval transport option ignored in async event loop #2439#2489
Open
ChickenBenny wants to merge 3 commits intocelery:mainfrom
Open
Fix: SQS polling_interval transport option ignored in async event loop #2439#2489ChickenBenny wants to merge 3 commits intocelery:mainfrom
polling_interval transport option ignored in async event loop #2439#2489ChickenBenny wants to merge 3 commits intocelery:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2489 +/- ##
==========================================
+ Coverage 82.22% 82.29% +0.07%
==========================================
Files 79 79
Lines 10077 10089 +12
Branches 1152 1152
==========================================
+ Hits 8286 8303 +17
+ Misses 1589 1584 -5
Partials 202 202 ☔ View full report in Codecov by Sentry. |
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.
Summary
Fixes #2439 — the
polling_intervalbroker transport option was completely ignored for SQS. Regardless of whether any messages were received, the poller would immediately reschedule the nextReceiveMessagecall viahub.call_soon(), causing SQS to be polled as fast as the network allows (limited only bywait_time_secondslong-polling).Root Cause
The SQS transport has its own async event-loop path that bypasses the
polling_intervalsleep used byvirtual.Transport.drain_events(). The call chain was:Two concrete bugs:
_loop1always calledhub.call_soon()— meaning the next poll was always scheduled immediately, regardless of whether the previous poll returned any messages._on_messages_readyhad no return value — so the callback (_loop1) could never know whether messages were found, making it impossible to decide whether to wait.Behaviour After Fix
polling_intervalseconds (default: 1s)polling_interval=0orNonebasic_consumecallpolling_interval=5Related
hub.call_laterAPI:kombu/asynchronous/hub.py— delegates toself.timer.call_after(delay, callback, args)