Signed-off-by: Xian Chaobo <xianchaobo@huawei.com>
This commit is contained in:
Xian Chaobo 2015-05-29 22:35:27 -04:00
parent c1934925fe
commit def00ea0a0
1 changed files with 1 additions and 4 deletions

View File

@ -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()
}