Skip to content

Document leased-timer visibility and cancel_all race in basic.md#18

Merged
lesnik512 merged 1 commit intomainfrom
b1-correlation-id-default-doc
May 4, 2026
Merged

Document leased-timer visibility and cancel_all race in basic.md#18
lesnik512 merged 1 commit intomainfrom
b1-correlation-id-default-doc

Conversation

@lesnik512
Copy link
Copy Markdown
Member

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.

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.
@lesnik512 lesnik512 self-assigned this May 4, 2026
@lesnik512 lesnik512 merged commit 6d76364 into main May 4, 2026
3 checks passed
@lesnik512 lesnik512 deleted the b1-correlation-id-default-doc branch May 4, 2026 05:40
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.

1 participant