Validate empty_timeout, fix its docstring, and add tests (follow-up to #155) - #156
Merged
Merged
Conversation
Follow-up to eandersson#155: build_inbound_messages now raises AMQPInvalidArgument when empty_timeout is not None and not a real, non-negative number (rejecting non-numeric values, bool, negatives and NaN) instead of failing later inside the loop, and the docstring notes that any falsy value (None or 0) exits immediately. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- a falsy empty_timeout (None or 0) exits immediately without consulting the timer. - a custom empty_timeout waits that long. - invalid empty_timeout (non-numeric, negative, bool, NaN) raises AMQPInvalidArgument. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
Thanks! On vacation so might take some time until I can review this properly. |
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.
Follow-up to #155 (the
empty_timeoutchange, shipped in 3.1.3) — the smaller points left for after merge.Changes
build_inbound_messagesnow raisesAMQPInvalidArgumentwhenempty_timeoutis notNoneand not a real, non-negative number. This rejects non-numeric values,bool(anintsubclass), negatives, andNaN— the last of which would otherwise makebreak_on_emptynever break while a consumer is active (elapsed >= NaNis alwaysFalse). Previously such values failed later inside the loop (e.g.TypeError) or hung.empty_timeoutis now typedint,float,None, and notes that any falsy value (Noneor0) exits immediately, matching the implementation.empty_timeout(None/0) exits immediately without consulting the timer; a custom value waits that long; an invalid value raisesAMQPInvalidArgument.Branches off
main(3.1.3). Unit tests andflake8pass locally.