Merge pull request #635 from harshavardhana/pr_out_fix_a_deadlock_in_trove_when_evicting_objects_when_we_reach_the_maxsize_used

Fix a deadlock in trove when evicting objects when we reach the maxSize used
master
Harshavardhana 10 years ago
commit 996c1a5c28
  1. 4
      pkg/storage/trove/trove.go

@ -127,13 +127,13 @@ func (r *Cache) Set(key string, value []byte) bool {
return false
}
// remove random key if only we reach the maxSize threshold
for key := range r.items {
for (r.currentSize + valueLen) > r.maxSize {
for key := range r.items {
r.doDelete(key)
}
break
}
}
}
r.items[key] = value
r.currentSize += valueLen
r.updatedAt[key] = time.Now()

Loading…
Cancel
Save