Merge pull request #27123 from tonistiigi/fix-join-reconnect

Don’t attempt to reconnect swarm on failed join after timeout
This commit is contained in:
Aaron Lehmann 2016-11-08 14:53:44 -08:00 committed by GitHub
commit 0ccbae0437
1 changed files with 9 additions and 2 deletions

View File

@ -498,8 +498,15 @@ func (c *Cluster) Join(req types.JoinRequest) error {
select {
case <-time.After(swarmConnectTimeout):
// attempt to connect will continue in background, also reconnecting
go c.reconnectOnFailure(n)
// attempt to connect will continue in background, but reconnect only if it didn't fail
go func() {
select {
case <-n.Ready():
c.reconnectOnFailure(n)
case <-n.done:
logrus.Errorf("failed to join the cluster: %+v", c.err)
}
}()
return ErrSwarmJoinTimeoutReached
case <-n.Ready():
go c.reconnectOnFailure(n)