Fix race condition when shutting down and watchPeers() run
License: MIT Signed-off-by: Hector Sanjuan <code@hector.link>
This commit is contained in:
parent
d63a5e2667
commit
ca3fe646b1
|
@ -313,6 +313,8 @@ func (c *Cluster) watchPeers() {
|
|||
}
|
||||
|
||||
if !hasMe {
|
||||
c.shutdownLock.Lock()
|
||||
defer c.shutdownLock.Unlock()
|
||||
logger.Infof("%s: removed from raft. Initiating shutdown", c.id.Pretty())
|
||||
c.removed = true
|
||||
go c.Shutdown()
|
||||
|
|
Loading…
Reference in New Issue
Block a user