aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/cache/object_lru.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/cache/object_lru.go')
-rw-r--r--plumbing/cache/object_lru.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/plumbing/cache/object_lru.go b/plumbing/cache/object_lru.go
index d99a5c9..9e850b2 100644
--- a/plumbing/cache/object_lru.go
+++ b/plumbing/cache/object_lru.go
@@ -55,7 +55,7 @@ func (c *ObjectLRU) Put(obj plumbing.EncodedObject) {
return
}
- if c.actualSize+objSize > c.MaxSize {
+ for c.actualSize+objSize > c.MaxSize {
last := c.ll.Back()
lastObj := last.Value.(plumbing.EncodedObject)
lastSize := FileSize(lastObj.Size())
@@ -63,10 +63,6 @@ func (c *ObjectLRU) Put(obj plumbing.EncodedObject) {
c.ll.Remove(last)
delete(c.cache, lastObj.Hash())
c.actualSize -= lastSize
-
- if c.actualSize+objSize > c.MaxSize {
- return
- }
}
ee := c.ll.PushFront(obj)