Add configurable timeout for break_on_empty - #155
Conversation
|
@tichi73 would you be open to reviewing this change? |
13df8b7 to
06de40e
Compare
|
Thanks for the follow-up @eandersson — making the grace configurable and having One thing I'd suggest fixing — a post-cancel in-flight message can be dropped. Moving The window is microscopic on loopback (which is why a no_ack post-cancel throughput test shows no loss), but it widens under network latency/load, and it's on the normal - if not self.consumer_tags:
+ if not self.consumer_tags and not self._inbound:
breakRepro: https://gist.github.com/tichi73/b753d22734163e5e40d14aa563fdc03c A few smaller things — entirely your call:
I prototyped fixes + tests for all of these on a branch (validated: the drop repro goes 0/5, throughput unchanged, 426 unit tests green) — happy to open a PR if useful. The in-flight drop is the only one I'd consider important; the rest are at your discretion. |
Thanks for the thorough review! I've fixed the most critical issues and left the rest to keep this PR manageable. If it looks good to you and you have time, a follow-up on the remaining points after it's merged would be much appreciated. |
|
Confirmed on |
Thanks again! |
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>
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>
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>
…#155) (#156) * Validate empty_timeout and align its docstring with the implementation Follow-up to #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> * Add tests for empty_timeout values and validation - 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> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the hardcoded 1.0s empty-queue wait in
build_inbound_messageswith a configurableempty_timeoutparam (default unchanged).process_data_eventsnow usesempty_timeout=Nonesostart_consumingreturns as soon as the queue drains, restoring 3.0.x consume responsiveness without dropping in-flight messages.