mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
wait on pull from another client
This commit is contained in:
parent
e3c3f3c324
commit
fb810b54ff
1 changed files with 8 additions and 2 deletions
10
server.go
10
server.go
|
@ -877,8 +877,14 @@ func (srv *Server) pullRepository(r *registry.Registry, out io.Writer, localName
|
|||
}
|
||||
|
||||
// ensure no two downloads of the same image happen at the same time
|
||||
if _, err := srv.poolAdd("pull", "img:"+img.ID); err != nil {
|
||||
utils.Errorf("Image (id: %s) pull is already running, skipping: %v", img.ID, err)
|
||||
if c, err := srv.poolAdd("pull", "img:"+img.ID); err != nil {
|
||||
if c != nil {
|
||||
out.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Layer already being pulled by another client. Waiting.", nil))
|
||||
<-c
|
||||
out.Write(sf.FormatProgress(utils.TruncateID(img.ID), "Download complete", nil))
|
||||
} else {
|
||||
utils.Errorf("Image (id: %s) pull is already running, skipping: %v", img.ID, err)
|
||||
}
|
||||
if parallel {
|
||||
errors <- nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue