Repository navigation
Conversation
GET /context/tracks never became ready for a spotify:station:track:<id> context: the enumeration got the station's opening tracks, then the radio-router answered 404 for a later page, so it failed, discarded what it had and was retried on every poll, forever. A station is endless, so there is no complete listing to wait for: once it yielded tracks, a page failure now ends the listing with the pages before it. A failure before any track and a cancelled enumeration stay errors, and every other context still fails the whole enumeration on any page, so a transient error on a long playlist is retried rather than cached as a short listing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
GET /context/tracks?uri=spotify:station:track:<id>never becomes ready. It keeps answeringready: false, length: 0, cached: 0, while albums and single tracks list fine (metadata enabled).Reproduction
GET /context/tracks?uri=spotify:station:track:4cOdK2wGLETKBW3PvgPWqTand keep polling it.ready: false, length: 0for good, and about every 2 s the daemon logs:The page indices in that log start at 0. Pages 0 and 1 load; the failing request lists their 50 tracks as
prev_tracks. Then the radio-router answers 404 for page 2.enumerateContextTrackstreats any page error as fatal, so it throws away the tracks it already has. Nothing is cached, and the next poll starts the same enumeration again.Fix
Stations get a narrow exception in
enumerateContextTracks. A station is an endless radio context, so there is never a complete listing to wait for. The radio-router may also answer 404 for a later page, and when it does, the pages it already served are all there is. So for aspotify:station:context that has already yielded tracks, a page failure now ends the listing with the tracks fetched so far, the same way the end of the context or the page cap does.Everything else keeps the current behaviour:
ctx.Err() != nil) is still an error, so a cut-off listing is never cached as the whole one.Only the context listing and its metadata sweep use this function. Autoplay and playback are unchanged.
Tests
TestEnumerateContextTracksKeepsStationPagesBeforeAFailure: a station's page 0 yields tracks and page 1 fails. Result: page 0's tracks, no error.TestEnumerateContextTracksReportsStationErrorsBeforeAnyTrack: a station's page 0 is empty and page 1 fails. Still an error.TestEnumerateContextTracksReportsStationCancellation: a station cancelled after a good page. Still an error.TestEnumerateContextTracksReportsLaterPageErrors: a playlist whose page 1 fails still errors, as before.TestEnumerateContextTracksReportsPageErrors(existing): a failing page 0 still errors.TestContextTracksHandlerListsStationFirstPage: through the API handler, a station whose page 1 fails answersready: truewithlength == cached ==the count from page 0. Without the fix it stays not-ready.go test -tags "test_unit test_integration" ./...,go vetandgofmt -l .are clean.