mirror of
https://github.com/minio/minio.git
synced 2024-12-28 08:05:55 -05:00
Merge pull request #544 from fkautz/pr_out_fixing_race_condition
This commit is contained in:
commit
73de05feb6
@ -501,9 +501,9 @@ func (memory *memoryDriver) expireObjects() {
|
|||||||
if memory.shutdown {
|
if memory.shutdown {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
var sleepDuration time.Duration
|
||||||
|
memory.lock.Lock()
|
||||||
if len(memory.objectMetadata) > 0 {
|
if len(memory.objectMetadata) > 0 {
|
||||||
var sleepDuration time.Duration
|
|
||||||
memory.lock.Lock()
|
|
||||||
if k, _, ok := memory.objects.GetOldest(); ok {
|
if k, _, ok := memory.objects.GetOldest(); ok {
|
||||||
key := k.(string)
|
key := k.(string)
|
||||||
object := memory.objectMetadata[key]
|
object := memory.objectMetadata[key]
|
||||||
@ -513,11 +513,11 @@ func (memory *memoryDriver) expireObjects() {
|
|||||||
sleepDuration = memory.expiration - time.Now().Sub(object.lastAccessed)
|
sleepDuration = memory.expiration - time.Now().Sub(object.lastAccessed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memory.lock.Unlock()
|
|
||||||
time.Sleep(sleepDuration)
|
|
||||||
} else {
|
} else {
|
||||||
time.Sleep(memory.expiration)
|
sleepDuration = memory.expiration
|
||||||
}
|
}
|
||||||
|
memory.lock.Unlock()
|
||||||
|
time.Sleep(sleepDuration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user