Count a late hit, and report no totals on a disabled cache (closes #56)
check / check (push) Successful in 3m12s
check / check (push) Successful in 3m12s
A hit is now counted with the request context detached from its cancellation, as the miss already is, so a hit served after the client left or the request timed out still moves the hit count. On a disabled disk cache, Stats reports no items and no size, whatever rows an earlier run left in the database; the size already followed that rule. Model: opus-5-5
This commit is contained in:
@@ -143,7 +143,8 @@ func (s *Service) Get(ctx context.Context, req *ImageRequest) (*ImageResponse, e
|
||||
s.log.Error("failed to get cached variant", "key", result.CacheKey, "error", err)
|
||||
// Fall through to re-process
|
||||
} else {
|
||||
s.cache.IncrementStats(ctx, true, 0)
|
||||
// Counted also when the request context has ended meanwhile
|
||||
s.cache.IncrementStats(context.WithoutCancel(ctx), true, 0)
|
||||
|
||||
return &ImageResponse{
|
||||
Content: reader,
|
||||
|
||||
Reference in New Issue
Block a user