Fix Last.fm import failures for large libraries with custom API keys and retry logic#1943
Closed
Fix Last.fm import failures for large libraries with custom API keys and retry logic#1943
Conversation
- Add API key field to Last.fm settings UI with helpful info text - Store and load custom API key from settings - Use custom API key in lastfmimport if provided, fall back to default - Implement exponential backoff retry logic (up to 5 retries) - Retry on HTTP 500/503 errors with increasing delays (5s, 10s, 20s, 40s, 80s) - Add retry count tracking to request structures Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
- Extract retry condition check into ShouldRetryRequest() helper - Extract backoff delay calculation into CalculateBackoffDelay() helper - Use helper methods in both GetRecentTracksRequestFinished and GetTopTracksRequestFinished - Improves code maintainability and consistency Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
- Add named constants for retry-eligible HTTP status codes (500, 503) - Add bounds checking in backoff calculation to prevent integer overflow - Use kMaxBackoffShift constant to limit bit shift operations - Improves code safety and readability Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
- Add LogRetryAttempt() helper method for consistent logging - Fix formatting in ShouldRetryRequest() for better readability - Use helper method in both GetRecentTracksRequestFinished and GetTopTracksRequestFinished - Eliminates duplicate logging code Co-authored-by: jonaski <10343810+jonaski@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Last.fm import issue for large libraries
Fix Last.fm import failures for large libraries with custom API keys and retry logic
Jan 3, 2026
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.
Last.fm import fails with HTTP 500 errors when users have large libraries (100k+ songs) due to rate limiting on the shared application API key.
Changes
Custom API Key Support
LastFMImportuses custom key if provided, falls back to defaultLastFM/api_keyExponential Backoff Retry
retry_countShouldRetryRequest(),CalculateBackoffDelay(),LogRetryAttempt()UI Changes
New field in Last.fm settings section with help text linking to API key creation page.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.