mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Avoid parallel layer downloads in load command
Signed-off-by: Doug MacEachern <dougm@vmware.com>
This commit is contained in:
parent
934535db9c
commit
de35ef2ebe
1 changed files with 14 additions and 0 deletions
|
@ -104,6 +104,20 @@ func (s *TagStore) recursiveLoad(eng *engine.Engine, address, tmpImageDir string
|
||||||
log.Debugf("Error validating ID: %s", err)
|
log.Debugf("Error validating ID: %s", err)
|
||||||
return 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 img.Parent != "" {
|
||||||
if !s.graph.Exists(img.Parent) {
|
if !s.graph.Exists(img.Parent) {
|
||||||
if err := s.recursiveLoad(eng, img.Parent, tmpImageDir); err != nil {
|
if err := s.recursiveLoad(eng, img.Parent, tmpImageDir); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue