mirror of https://github.com/docker/docs.git
Fix a race condition in pending engine validation, discard parallel validation result.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
This commit is contained in:
parent
05f9a6a6fb
commit
39dc28a4df
|
|
@ -271,6 +271,11 @@ func (c *Cluster) validatePendingEngine(engine *cluster.Engine) bool {
|
||||||
c.Lock()
|
c.Lock()
|
||||||
defer c.Unlock()
|
defer c.Unlock()
|
||||||
|
|
||||||
|
// Only validate engines from pendingEngines list
|
||||||
|
if _, exists := c.pendingEngines[engine.Addr]; !exists {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure the engine ID is unique.
|
// Make sure the engine ID is unique.
|
||||||
if old, exists := c.engines[engine.ID]; exists {
|
if old, exists := c.engines[engine.ID]; exists {
|
||||||
if old.Addr != engine.Addr {
|
if old.Addr != engine.Addr {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue