Merge pull request #10888 from dougm/parallel-load

Avoid parallel layer downloads in load command
This commit is contained in:
Alexander Morozov 2015-02-20 11:01:40 -08:00
commit 15bf67a998

View file

@ -104,6 +104,20 @@ func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string
log.Debugf("Error validating ID: %s", err)
return err
}
// ensure no two downloads of the same layer happen at the same time
if c, err := s.poolAdd("pull", "layer:"+img.ID); err != nil {
if c != nil {
log.Debugf("Image (id: %s) load is already running, waiting: %v", img.ID, err)
<-c
return nil
}
return err
}
defer s.poolRemove("pull", "layer:"+img.ID)
if img.Parent != "" {
if !s.graph.Exists(img.Parent) {
if err := s.recursiveLoad(eng, img.Parent, tmpImageDir); err != nil {