Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Christian Haudum <[email protected]>
  • Loading branch information
Danny Kopping and chaudum authored Jan 11, 2024
1 parent e23b296 commit ebcb216
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/storage/chunk/cache/background.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,10 @@ func (c *backgroundCache) Store(ctx context.Context, keys []string, bufs [][]byt

size := bgWrite.size()
// prospectively add new size
c.size.Add(int64(size))

newSize := c.size.Load()
newSize := c.size.Add(int64(size))
if newSize > int64(c.sizeLimit) {
// subtract it since we've exceeded the limit
c.size.Add(-int64(size))
c.size.Sub(int64(size))
c.failStore(ctx, size, num, "queue at byte size limit")
return nil
}
Expand Down

0 comments on commit ebcb216

Please sign in to comment.