Remove expired negative cache rows in the eviction loop (closes #244)
check / check (push) Canceled after 0s
check / check (push) Canceled after 0s
A negative cache row was deleted only when its URL was requested again, so a client asking for a new missing path each time grew the database without limit. The eviction goroutine now removes expired rows at startup and on every tick, so a row stays about NegativeTTL plus one eviction interval. It deletes at most 1000 rows per statement, so a request on the one database connection waits behind one batch at most. The goroutine now also runs when the disk cache is disabled, since the negative cache is used either way. Model: opus-5-5
This commit was merged in pull request #262.
This commit is contained in:
@@ -124,7 +124,8 @@ func (s *Handlers) initImageService() error {
|
||||
s.imgCache = cache
|
||||
|
||||
// Background eviction: startup reconciliation, then periodic and
|
||||
// write-pressure passes. No-op when the disk cache is disabled.
|
||||
// write-pressure passes, and the removal of expired negative cache
|
||||
// rows, which is all it does when the disk cache is disabled.
|
||||
cache.StartEviction(imgcache.DefaultEvictionInterval)
|
||||
|
||||
// Writes the counts requests could not write by their deadline
|
||||
|
||||
Reference in New Issue
Block a user