Repository navigation
Refresh the session once for concurrent callers, and smaller review fixes - #7
Merged
Merged
Conversation
When the session expired during concurrent downloads, every in-flight call refreshed the token separately, so "retry once" became one deezer.getUserData call per request at the same moment. SetToken now holds a lock and tracks a token version: a caller whose request used an older token reuses a refresh that finished after its request was sent. SetARL forces a refresh so a new ARL always gets its own session. GetTrackUrl also throws InvalidARLException when no ARL is set, instead of a NullReferenceException. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Dispose HttpResponseMessage in GWApi, PublicApi, GetTrackUrl, LRCLIB, MusicBrainz, and UnshortenURL. - UnshortenURL accepts any 3xx redirect, not only 302. - MusicBrainz lookups and the tagging block no longer swallow cancellation. - EscapeSearch escapes backslashes before quotes. - ApplyMetadataToTrackStream reads all four magic bytes across short reads. - RemoveSongs(s)FromPlaylist pass their cancellation token. - The MusicBrainz user agent reads its version from the assembly. - Bump to 1.2.6. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Single-flight token refresh (review item 7)
When the session expired during concurrent downloads (in the plugin, two albums downloading at once share one client), every in-flight call refreshed the token separately, so "retry once" became one
deezer.getUserDatacall per request at the same moment. That burst is what the 1.2.3 retry limit was meant to prevent.SetTokennow holds aSemaphoreSlimand tracks a token version.GWApi.CallandGetTrackUrlrecord the version their request used; when Deezer rejects it,SetTokenskips the refresh if another caller already refreshed after that request was sent.SetARLpassesforce: trueso a new ARL always gets its own session.deezer.getUserDataitself never refreshes, so the lock can't deadlock.New tests in
TokenRefreshTestsuse a fakeHttpMessageHandler:getUserDatacall.GetTrackcalls rejected withVALID_TOKEN_REQUIREDcause one refresh and then succeed. This test takes about 2 seconds because of the existing retry delay.GetTrackUrlalso throwsInvalidARLExceptionwhen no ARL is set, instead of aNullReferenceException(item 10).Smaller fixes
HttpResponseMessageis disposed inGWApi.Call,PublicApi.Call,GetTrackUrl, the LRCLIB and MusicBrainz lookups, andUnshortenURL.UnshortenURLaccepts any 3xx redirect.EscapeSearchescapes backslashes before quotes.ApplyMetadataToTrackStreamreads all four magic bytes across short reads.RemoveSongsFromPlaylist/RemoveSongFromPlaylistpass their cancellation token. Adding the optional parameter is source-compatible but changes the binary signature; nothing outside this repo calls it as a compiled package.Left as is:
GetLowerFallbackBitrate(MP3_128)returnsMP3_320. The name says "lower", but changing it would remove the plugin's only fallback for 128 kbps requests.Bumps the version to 1.2.6 with a changelog entry.
🤖 Generated with Claude Code