Skip to content

refactor(protocol): rename _wait_for_block to _wait_live - #62

Merged
QuiteYellow merged 1 commit into
mainfrom
refactor/wait-live-rename
Aug 23, 2026
Merged

refactor(protocol): rename _wait_for_block to _wait_live#62
QuiteYellow merged 1 commit into
mainfrom
refactor/wait-live-rename

Conversation

@QuiteYellow

Copy link
Copy Markdown
Owner

@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 Event in slices and polls _check_live() between them, so a dead reader surfaces as SessionClosedError within one poll interval. That is true on main today, and #54 adds post() as a second caller, at which point _wait_for_block reads 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:

        deadline = time.time() + per_wait

while #36 moved the function to time.monotonic(). The loop body below merges cleanly and still reads deadline - time.monotonic(), so the mismatch never appears inside the conflict markers. Resolving it the obvious way mixes epoch seconds with uptime seconds, slice_s pins 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_S comment 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.

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.
@QuiteYellow
QuiteYellow merged commit 9dc45a6 into main Aug 23, 2026
8 checks passed
@QuiteYellow
QuiteYellow deleted the refactor/wait-live-rename branch August 23, 2026 09:25
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