mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Merge pull request #2121 from nats-io/mb-close-fix
js: msgblock close fix
This commit is contained in:
@@ -118,6 +118,7 @@ type msgBlock struct {
|
||||
fch chan struct{}
|
||||
qch chan struct{}
|
||||
lchk [8]byte
|
||||
closed bool
|
||||
}
|
||||
|
||||
// Write through caching layer that is also used on loading messages.
|
||||
@@ -3176,9 +3177,10 @@ func (mb *msgBlock) close(sync bool) {
|
||||
mb.mu.Lock()
|
||||
defer mb.mu.Unlock()
|
||||
|
||||
if mb.qch == nil {
|
||||
if mb.closed {
|
||||
return
|
||||
}
|
||||
mb.closed = true
|
||||
|
||||
// Close cache
|
||||
mb.clearCacheAndOffset()
|
||||
|
||||
@@ -182,13 +182,14 @@ func (c *cluster) shutdown() {
|
||||
return
|
||||
}
|
||||
for i, s := range c.servers {
|
||||
sd := s.StoreDir()
|
||||
s.Shutdown()
|
||||
if cf := c.opts[i].ConfigFile; cf != "" {
|
||||
os.RemoveAll(cf)
|
||||
}
|
||||
if sd := s.StoreDir(); sd != "" {
|
||||
if sd != _EMPTY_ {
|
||||
os.RemoveAll(sd)
|
||||
}
|
||||
s.Shutdown()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user