Skip to content

Validate empty_timeout, fix its docstring, and add tests (follow-up to #155) - #156

Merged
eandersson merged 2 commits into
eandersson:mainfrom
tichi73:empty-timeout-followup
Jul 6, 2026
Merged

Validate empty_timeout, fix its docstring, and add tests (follow-up to #155)#156
eandersson merged 2 commits into
eandersson:mainfrom
tichi73:empty-timeout-followup

Conversation

@tichi73

@tichi73 tichi73 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #155 (the empty_timeout change, shipped in 3.1.3) — the smaller points left for after merge.

Changes

  • Validation. build_inbound_messages now raises AMQPInvalidArgument when empty_timeout is not None and not a real, non-negative number. This rejects non-numeric values, bool (an int subclass), negatives, and NaN — the last of which would otherwise make break_on_empty never break while a consumer is active (elapsed >= NaN is always False). Previously such values failed later inside the loop (e.g. TypeError) or hung.
  • Docstring. empty_timeout is now typed int,float,None, and notes that any falsy value (None or 0) exits immediately, matching the implementation.
  • Tests. A falsy empty_timeout (None/0) exits immediately without consulting the timer; a custom value waits that long; an invalid value raises AMQPInvalidArgument.

Branches off main (3.1.3). Unit tests and flake8 pass locally.

tichi73 and others added 2 commits June 29, 2026 09:18
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>
@eandersson

Copy link
Copy Markdown
Owner

Thanks! On vacation so might take some time until I can review this properly.

@eandersson
eandersson merged commit efdef92 into eandersson:main Jul 6, 2026
6 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.

2 participants