You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: save and restore playback state across session reconnects
When SpircTask exits due to session loss, it now saves its
ConnectState, SpircPlayStatus, and play_request_id into a
SavedPlaybackState. main.rs captures this and passes it to
Spirc::with_saved_state() when creating the replacement Spirc.
The restored SpircTask starts with the saved state. On the first
connection_id_update, it updates the playback position to account for
elapsed time and re-registers with Spotify showing the correct track
and position. The Player is never interrupted.
After fix — 6 days of logs (Mar 14-20) showing 5 TCP session losses
all recovered with playback state preserved:
Mar 18 11:49 — "Connection to server closed."
Mar 18 11:52 — "session lost, saving playback state for recovery:
Playing { nominal_start_time: 1773834169899, ... }"
Mar 18 11:52 — "Spirc shut down with saved playback state, reconnecting"
Mar 18 11:52 — "Spirc[1] restoring saved playback state"
Mar 18 11:52 — "re-registering with active playback state:
Playing { nominal_start_time: 1773834169899, ... }"
[3 second recovery, playback never stopped]
Mar 19 12:21-12:37 — Two session losses during active playback,
both recovered in ~2 seconds with Playing state preserved.
Summary over 6 days post-fix (Mar 14-20):
- 0 "Spirc shut down unexpectedly" (vs ~2-3/day before fix)
- 0 process restarts needed
- 5 session TCP losses, all recovered with state preserved
- ~20 dealer reconnects, all handled in-place
- Process running continuously (Spirc counter reached Spirc[4])
Co-authored-by: Copilot <[email protected]>
0 commit comments