fix: rate-limit MB url-rels fetches, serialize frontend image loads
Artist image resolution was hitting musicbrainz.org with 10 concurrent unthrottled requests per search — enough to trigger MB's rate limit rejection. Two fixes: Backend: add dedicated 1 req/s RateLimiter for MB url-rels fetches in ArtistImageProvider. Each fetch waits on the limiter before the HTTP call. Results are cached 30 days so repeat lookups are instant. Frontend: switch loadArtistImages from concurrent fire-all to sequential await loop. Each artist image loads one at a time, images appear progressively as they resolve instead of all failing from rate limit rejection.
This commit is contained in:
@@ -38,7 +38,7 @@ func NewExploreService(logger *slog.Logger, db *database.DB) *Service {
|
||||
lb := NewListenBrainzClient(limiter, cache, logger.WithGroup("listenbrainz"))
|
||||
index := NewSearchIndex(db, lb, logger.WithGroup("search-index"))
|
||||
artProxy := NewCoverArtProxy(db, limiter)
|
||||
artistImg := NewArtistImageProvider(cache, logger.WithGroup("artist-image"))
|
||||
artistImg := NewArtistImageProvider(cache, NewRateLimiter(), logger.WithGroup("artist-image"))
|
||||
|
||||
logger.Info("explore service created")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user