Document leased-timer visibility and cancel_all race in basic.md#18
Merged
Document leased-timer visibility and cancel_all race in basic.md#18
Conversation
Two facts about the inspection methods are only captured in `broker.py` docstrings: - Leased (in-flight) timers have their score pushed forward by `lease_ttl`, so they still appear in `has_pending` and the default `get_pending_timers(before=None)`. A user polling `has_pending` to detect "fired and finished" will get false positives during the lease window — recommend `before=datetime.now(tz=UTC)`. - `cancel_all(topic)` running mid-handler lets the handler finish; its final commit becomes a no-op because the keys are already gone. Side effects are not rolled back. Pull both into the "Inspecting pending timers" section of basic.md.
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.
Two facts about the inspection methods are only captured in
broker.pydocstrings:lease_ttl, so they still appear inhas_pendingand the defaultget_pending_timers(before=None). A user pollinghas_pendingto detect "fired and finished" will get false positives during the lease window — recommendbefore=datetime.now(tz=UTC).cancel_all(topic)running mid-handler lets the handler finish; its final commit becomes a no-op because the keys are already gone. Side effects are not rolled back.Pull both into the "Inspecting pending timers" section of basic.md.