fix(providers): Last.fm's rate limit retries art later, and both Last.fm sources share one pace (#8002)

The cover-art Last.fm provider read every JSON error code as "no art",
so a burst of rate-limit (29) or service-unavailable (8, 11, 16)
answers marked albums and artists as having nothing on Last.fm. The tag
provider already retried those. providers.LastfmError is now the one
mapping, used by both.

Each family also paced Last.fm on its own at 4 requests a second, so
together they could reach 8 a second against the 5-per-key limit when
an admin uses one key for both. Both now wait on providers.LastfmPacer.
The client's own spacing is a providers.Interval, so a pace can be
shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 13:00:51 -05:00
co-authored by Claude Opus 5.5
parent b901560edf
commit d8abc457e7
6 changed files with 125 additions and 57 deletions
+14
View File
@@ -0,0 +1,14 @@
package providers
import (
"errors"
"testing"
)
func TestLastfmError(t *testing.T) {
for code, want := range map[int]error{0: nil, 6: ErrNotFound, 10: ErrNotFound, 8: ErrTransient, 11: ErrTransient, 16: ErrTransient, 29: ErrTransient} {
if got := LastfmError(code); !errors.Is(got, want) || (want == nil && got != nil) {
t.Errorf("LastfmError(%d) = %v, want %v", code, got, want)
}
}
}