mirror of
https://github.com/zoriya/v10.git
synced 2026-08-15 18:34:22 +00:00
Replace the imperative `#loop()` with a single chained promise: each cycle's `.then` returns the next cycle's `schedule(clone())`, so the recurrence is the method calling itself. The slot is released just before re-scheduling the same-id clone so the call advances rather than dedup-returning; ownership is tracked by `#active === task`. Error handling moves downstream — the runner no longer invents a retry policy: - A genuine run/reschedule failure rejects schedule()'s promise (propagates to the caller); no swallowing. - The runner's own cancellation (abort/supersede/destroy) is not a failure, so an aborted recurrence settles quietly — callers don't `.catch` routine teardown. Consequences: - `reschedule` is now required; `runOnce` expresses run-exactly-once explicitly (a missing reschedule is a bug, not a silent run-once). - Reschedule-driven retry-on-transient-error is dropped (a rejected run is terminal). The retry logic in delayedReschedule / mediaPlaylistReloadDelay is now vestigial — to be cleaned up or relocated to the fetch layer next. - `resolve-track` catches schedule()'s promise (abort settles quietly; genuine resolve failures end the recurrence, TODO surface to state). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>