fix: address code review findings
This commit is contained in:
@@ -169,6 +169,12 @@ func SetReleaseIgnored(db *DB, rgid string, ignored bool) error {
|
||||
// GetExternalReleasesByArtistWithCache returns cached external_release rows for a given artist_id
|
||||
// that are within the specified TTL.
|
||||
func GetExternalReleasesByArtistWithCache(db *DB, artistID string, ttl time.Duration) ([]ExternalRelease, error) {
|
||||
// A zero or negative TTL means "no cache" — always expire. Returning early
|
||||
// here avoids the boundary pitfall where cutoff == now would treat rows
|
||||
// cached in the current second as fresh.
|
||||
if ttl <= 0 {
|
||||
return nil, nil
|
||||
}
|
||||
// cached_at is stored in the "2006-01-02 15:04:05" UTC layout via
|
||||
// FormatCachedAt. Compare against an explicitly formatted cutoff string in
|
||||
// the same layout so the lexicographic comparison is a valid time ordering.
|
||||
|
||||
Reference in New Issue
Block a user