Fix LastFM rate limiting dropping scrobbles (f91fdd53 follow-up)

This commit is contained in:
2026-08-08 00:40:29 -04:00
parent f8094fb1b0
commit d5a753146f
3 changed files with 66 additions and 9 deletions

View File

@ -35,6 +35,15 @@ Two real bugs were found and fixed:
Tests added in `tests/scrobbles_tests/test_lastfm.py` (5 tests) covering
dedup-by-timestamp, creation, and dispatch resume/no-resume behavior.
A follow-up fix on 2026-08-08: the per-scrobble `track.getDuration`/
`getMbid` API calls in `get_last_scrobbles` exhausted Last.fm's rate limit
during large imports, raising `WSError` for almost every track and dropping
the whole scrobble (the artist lookup lived in the same `try`, so any failure
left `artist` unset). Artist now comes straight from the recent-tracks
response (no API call), duration/MBID enrichment is best-effort, and
enrichment calls are throttled to ~0.2s each. Test added for the
artist-survives-enrichment-failure path.
** DONE [#B] Fix LookupError on scrobble start/long-plays views :bug:scrobbles:videos:
:PROPERTIES:
:ID: 868e2a91-c974-4656-a8ae-b90a1f94ae74