From def00ea0a06eae4fea61e0764dcb52c9bb78dca2 Mon Sep 17 00:00:00 2001 From: Xian Chaobo Date: Fri, 29 May 2015 22:35:27 -0400 Subject: [PATCH] fix load Signed-off-by: Xian Chaobo --- cluster/swarm/cluster.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cluster/swarm/cluster.go b/cluster/swarm/cluster.go index 32e0ed7946..47a40c0431 100644 --- a/cluster/swarm/cluster.go +++ b/cluster/swarm/cluster.go @@ -332,12 +332,10 @@ func (c *Cluster) Load(imageReader io.Reader, callback func(what, status string) c.RLock() pipeWriters := []*io.PipeWriter{} - pipeReaders := []*io.PipeReader{} for _, n := range c.engines { wg.Add(1) pipeReader, pipeWriter := io.Pipe() - pipeReaders = append(pipeReaders, pipeReader) pipeWriters = append(pipeWriters, pipeWriter) go func(reader *io.PipeReader, nn *cluster.Engine) { @@ -353,6 +351,7 @@ func (c *Cluster) Load(imageReader io.Reader, callback func(what, status string) } }(pipeReader, n) } + c.RUnlock() // create multi-writer listWriter := []io.Writer{} @@ -372,8 +371,6 @@ func (c *Cluster) Load(imageReader io.Reader, callback func(what, status string) pipeW.Close() } - c.RUnlock() - wg.Wait() }