Skip to content

feat(deezer): cache album metadata to avoid redundant API calls#1000

Open
berettavexee wants to merge 2 commits into
nathom:devfrom
berettavexee:api-cache-optimizations
Open

feat(deezer): cache album metadata to avoid redundant API calls#1000
berettavexee wants to merge 2 commits into
nathom:devfrom
berettavexee:api-cache-optimizations

Conversation

@berettavexee

@berettavexee berettavexee commented Jun 16, 2026

Copy link
Copy Markdown

Summary

When downloading a Deezer album, get_album can be called multiple times for the same album ID (e.g. once for the album itself, and once per track via get_track). This PR adds an in-memory cache on DeezerClient so that repeated lookups for the same album ID return immediately without hitting the API again. This halves the number of API calls required to download an album. No changes to playlists.

  • Add self._album_cache: dict in DeezerClient.__init__
  • Check the cache at the top of get_album; store the result before returning
  • Add a unit test verifying the API is called exactly once for repeated get_album calls on the same ID

Test plan

  • Unit test test_deezer_album_cache passes: verifies get_album called twice with the same ID hits the API only once
  • Manual: download a Deezer album and confirm no duplicate API calls in verbose logs

🤖 Generated with Claude Code
👌 Tested by a human

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant