Fix ocache closing
This commit is contained in:
parent
ddae2be2a1
commit
5ecef4d6f5
@ -409,9 +409,13 @@ func (c *oCache) Close() (err error) {
|
||||
}
|
||||
c.closed = true
|
||||
close(c.closeCh)
|
||||
var toClose []*entry
|
||||
var toClose, alreadyClosing []*entry
|
||||
for _, e := range c.data {
|
||||
toClose = append(toClose, e)
|
||||
if e.isClosing {
|
||||
alreadyClosing = append(alreadyClosing, e)
|
||||
} else {
|
||||
toClose = append(toClose, e)
|
||||
}
|
||||
}
|
||||
c.mu.Unlock()
|
||||
for _, e := range toClose {
|
||||
@ -422,5 +426,8 @@ func (c *oCache) Close() (err error) {
|
||||
}
|
||||
}
|
||||
}
|
||||
for _, e := range alreadyClosing {
|
||||
<-e.close
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user