Bug: Negative cache is never checked - checkNegativeCache is dead code #3
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: sneak/pixa#3
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
The
Cache.checkNegativeCache()method ininternal/imgcache/cache.gois implemented but never called anywhere in the codebase. TheService.Get()method goes straight toLookup()for variant cache, then toprocessFromSourceOrFetch(), without ever consulting the negative cache.Meanwhile,
StoreNegative()IS called fromfetchAndProcess()when an upstream error occurs, so negative entries accumulate in the database but are never read.Impact
Failed upstream fetches are re-attempted on every request instead of being short-circuited by the negative cache. This means:
NegativeTTLconfiguration has no effectCleanExpiredwhich also isn't called regularly)Fix
Add a negative cache check at the beginning of
Service.Get(), before attempting to fetch from upstream. If the URL is in the negative cache, return an appropriate error immediately.