fix: address second code review findings
- Add CacheTTL default (24h) in config applyDefaults — without this, omitting cache_ttl from config silently defeats the entire caching mechanism (TTL=0 means cached data is never served) - Fix pagination to use total Count instead of checking if last page was short — avoids wasting a rate-limit token when total count is an exact multiple of 100 - Preserve user-set IsIgnored flags across re-syncs — previously, DELETE+INSERT in the sync transaction reset all ignore flags to false, losing user preferences on every cache-expiry re-sync - Check context cancellation on cache-hit code path — previously, ctx.Err() was not checked between cache check and returning cached data, violating the cancellation contract
This commit is contained in:
@@ -56,8 +56,8 @@ func (c *MusicBrainzClient) GetArtistReleaseGroups(ctx context.Context, artistMB
|
||||
|
||||
allGroups = append(allGroups, parsed.ReleaseGroups...)
|
||||
|
||||
// If we got fewer results than the limit, we've reached the end
|
||||
if len(parsed.ReleaseGroups) < limit {
|
||||
// If we've fetched all results, we've reached the end.
|
||||
if offset+len(parsed.ReleaseGroups) >= parsed.Count {
|
||||
break
|
||||
}
|
||||
offset += limit
|
||||
|
||||
Reference in New Issue
Block a user