Skip to content

fix: propagate std.Io sleep cancellation through poll and retry loops#296

Merged
indaco merged 5 commits intomainfrom
fix/sleep-cancel-propagation
May 7, 2026
Merged

fix: propagate std.Io sleep cancellation through poll and retry loops#296
indaco merged 5 commits intomainfrom
fix/sleep-cancel-propagation

Conversation

@indaco
Copy link
Copy Markdown
Owner

@indaco indaco commented May 7, 2026

Description

Tightens cancellation handling in three loops that drop error.Canceled from std.Io.sleep. std.Io cancellation is single-shot per task: a swallowed Canceled consumes the caller's stop signal so the next operation never sees it, leaving the loop to busy-spin (services follow-log) or run all retries to completion (HTTP and bottle download). With the fix, a cancelled sleep ends the loop with the right shape per call site - a clean break for tail-follow and bottle-retry, an error.Canceled return for HTTP - so a future Ctrl-C lands when the user pressed it instead of one round-trip later.

Related Issue

  • None

Notes for Reviewers

  • None

indaco added 5 commits May 7, 2026 20:53
The follow-log loop swallowed a cancelled sleep, so a stop signal that
reached the io subsystem before the interrupt flag flipped left the
loop busy-spinning. Propagate the cancellation as a clean exit.
std.Io cancellation is single-shot per task: a backoff-sleep that
catches and discards Canceled consumes the caller's stop signal, so
the next request never sees it and the retry loop runs to completion.
Surface Canceled as the result instead.
Symmetric with the net retry path: a swallowed Canceled would consume
the caller's stop signal so the next attempt's blocking call never
sees it. Surface the cancellation by exiting the retry loop instead.
Pin three additional behaviours of the cancel-on-sleep path: late
cancellation after several idle polls, that the loop doesn't latch
on the prior non-cancelled returns, and that data appended just
before the cancel is still flushed to the writer.
The spinner's stop_flag is the primary cancellation seam, but the
loop should also bail if the io subsystem reports cancellation
mid-tick rather than waiting another iteration for the flag to be
set.
@indaco indaco merged commit e222c31 into main May 7, 2026
3 checks passed
@indaco indaco deleted the fix/sleep-cancel-propagation branch May 7, 2026 19:22
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