Fix a potential race between ExpireObjects() and Set() over items map

master
Harshavardhana 10 years ago
parent 3fc9b4554f
commit 193a6606db
  1. 5
      pkg/storage/drivers/memory/memory_intelligent.go

@ -89,13 +89,14 @@ func (r *Intelligent) ExpireObjects(gcInterval time.Duration) {
r.gcInterval = gcInterval
go func() {
for range time.Tick(gcInterval) {
r.Lock()
for key := range r.items {
r.Lock()
if !r.isValid(key) {
r.Delete(key)
}
r.Unlock()
}
r.Unlock()
}
}()
}

Loading…
Cancel
Save