瀏覽代碼

Fix for situation where swarm leave causes wait forever for agent to stop

In this case the message to stop the agent is never actually sent
because the swarm node is nil

Signed-off-by: Kyle Wuolle <kyle.wuolle@gmail.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Kyle Wuolle 6 年之前
父節點
當前提交
e65c680394
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      daemon/cluster/noderunner.go

+ 5 - 0
daemon/cluster/noderunner.go

@@ -298,6 +298,11 @@ func (n *nodeRunner) Stop() error {
 		n.cancelReconnect = nil
 	}
 	if n.swarmNode == nil {
+		// even though the swarm node is nil we still may need
+		// to send a node leave event to perform any cleanup required.
+		if n.cluster != nil {
+			n.cluster.SendClusterEvent(lncluster.EventNodeLeave)
+		}
 		n.mu.Unlock()
 		return nil
 	}