Skip to content

Record the song still playing when the app quits - #47

Open
VitzS7 wants to merge 1 commit into
fatyzzz:mainfrom
VitzS7:history-last-play
Open

VitzS7 wants to merge 1 commit into
fatyzzz:mainfrom
VitzS7:history-last-play

Conversation

@VitzS7

@VitzS7 VitzS7 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

The last song of a session never reached the local play history.

A play is only closed when the next track starts. When the app quits mid song (or after the queue ran out), nothing closed it, and the TrackEnded event would have arrived after the history was already flushed, since the broadcast listener no longer runs at that point.

Now on quit the player actor closes the open play and returns its TrackEnded from PlayerHandle::shutdown(), and Services::shutdown records it (local plays only) before saving the history.

New test quitting_ends_the_song_still_playing; cargo test --locked -p sf-player -p sf-services and the release build pass.

A play was only closed when the next track started, so the last song of a
session (the queue ran out, or the app was closed mid-song) never produced
TrackEnded and never reached the local history. On quit the player actor
now closes the open play and hands its TrackEnded back from shutdown();
Services::shutdown records it before flushing the history, since the
broadcast listener no longer runs at that point.
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