refactor(protocol): rename _wait_for_block to _wait_live - #62
Merged
Conversation
Nothing in the helper is block-specific. It waits on an Event in slices and polls _check_live() between them, so a dead reader surfaces as SessionClosedError within one poll interval. #54 adds post() as a second caller, at which point the old name reads as wrong. Landing it on its own keeps it out of #54's rebase, where #36 and #54 edit the same lines and the resolution has a trap: #54's side carries time.time() while #36 moved the function to time.monotonic(), and the loop body that reads deadline - time.monotonic() merges cleanly below the conflict markers. Mixing the two pins slice_s to the poll interval and removes the per-attempt timeout entirely. Docstring and the _BLOCK_LIVENESS_POLL_S comment are mbillow's wording from #54, taken verbatim so those hunks vanish from their diff.
This was referenced Aug 23, 2026
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.
@mbillow proposed this rename in #54 and offered to drop it if I preferred the old name. I would rather have it, so it lands here on its own.
Nothing in the helper is block-specific: it waits on an
Eventin slices and polls_check_live()between them, so a dead reader surfaces asSessionClosedErrorwithin one poll interval. That is true onmaintoday, and #54 addspost()as a second caller, at which point_wait_for_blockreads as the wrong name.Why separately
#36 rewrote this function in the same lines #54 renames, and the merge has a trap. #54's side of the conflict ends on:
while #36 moved the function to
time.monotonic(). The loop body below merges cleanly and still readsdeadline - time.monotonic(), so the mismatch never appears inside the conflict markers. Resolving it the obvious way mixes epoch seconds with uptime seconds,slice_spins to the poll interval forever, and the per-attempt timeout stops existing: the wait then ends only when the response arrives or the reader dies, so a silent device hangs the call and the retransmission never fires. Every test stubs this function out, so nothing catches it.Landing the rename as a rebase onto #36 keeps
time.monotonic()by construction, and #54 rebases onto a tree that already has the new name.Contents
The function, its one call site in
_exchange_block, and the six stub lines across the three test files. The docstring and the_BLOCK_LIVENESS_POLL_Scomment are @mbillow's wording from #54, taken verbatim so those hunks disappear from their diff on rebase.403 pass. Ruff reports the same count on the touched files before and after.