Skip to content

Use a monotonic clock for stream stall detection - #268

Merged
jsgrrchg merged 1 commit into
developfrom
issue-264-monotonic-stall-clock
Aug 9, 2026
Merged

jsgrrchg merged 1 commit into
developfrom
issue-264-monotonic-stall-clock

Conversation

@jsgrrchg

@jsgrrchg jsgrrchg commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Replaces wall-clock Unix timestamps with a shared monotonic ProgressClock for stream download progress tracking.

Both stall consumers now use std::time::Instant:

  • The file-backed YouTube reader still signals an underrun after 12 seconds without download progress.
  • The player-side stall check still schedules reconnection after 30 seconds for live streams or 60 seconds for on-demand streams.

This prevents manual clock changes, NTP corrections, and other wall-clock adjustments from causing false stalls or delaying recovery. The progress clock also recovers from poisoned locks, matching the existing stream lock behavior.

Deterministic tests cover the 12, 30, and 60-second thresholds without sleeping or depending on the system clock.

Closes #264

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Refactor / cleanup
  • Other:

Checklist

  • cargo fmt passes
  • cargo clippy -- -D warnings passes
  • UI strings added/changed are present in both locales/en.json and locales/es.json (no UI strings changed)
  • No unwrap() introduced — uses expect("reason") or ?
  • Tested manually on Windows

Testing

  • cargo test — 245 passed
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --check
  • git diff --check

@jsgrrchg
jsgrrchg requested a review from sewandev as a code owner August 9, 2026 12:00
@jsgrrchg

jsgrrchg commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

Residual risk is low, there is no integration test using a real download, but the shared abstraction and unit tests directly cover the root cause. The branch is ready to merge.

@jsgrrchg
jsgrrchg merged commit 1265029 into develop Aug 9, 2026
7 checks passed
@jsgrrchg
jsgrrchg deleted the issue-264-monotonic-stall-clock branch August 9, 2026 15:56
@sewandev sewandev mentioned this pull request Sep 7, 2026
sewandev added a commit that referenced this pull request Sep 7, 2026
## Release v1.5.8

Version bump and changelog cut for the v1.5.8 release.

### Changes
- \Cargo.toml\ / \Cargo.lock\: version \1.5.7\ -> \1.5.8\
- \CHANGELOG.md\ / \CHANGELOG.es.md\: moved \[Unreleased]\ to \[1.5.8] -
2026-09-07\, added a fresh empty \[Unreleased]\ / \[Sin publicar]\

### Included since v1.5.7
- fix: monotonic clock for stream stall detection (#268)
- fix: serialize Spotify remote skip commands (#267)
- fix: ensure required CI check reports lint failures (#266)
- ci: separate lint job and integrate swatinem/rust-cache (#250)
- docs: add winget as the easy Windows install method (#249)
- build(deps): update Ratatui, Zip, Bytes, Clap, Rand, Thiserror and
Actions
sewandev added a commit that referenced this pull request Sep 7, 2026
## v1.5.8 release

Promotes `develop` to `main` for the v1.5.8 release.

### Included since v1.5.7
- fix: monotonic clock for stream stall detection (#268)
- fix: serialize Spotify remote skip commands (#267)
- fix: ensure required CI check reports lint failures (#266)
- ci: separate lint job and integrate swatinem/rust-cache (#250)
- docs: add winget as the easy Windows install method (#249)
- build(deps): update Ratatui, Zip, Bytes, Clap, Rand, Thiserror and
Actions

Merge with "Create a merge commit" (never squash/rebase).
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.

Use a monotonic clock for YouTube download stall detection

1 participant