mirror of
https://github.com/imjasonh/kontain.me
synced 2026-07-18 23:03:06 +00:00
write alsos concurrently
This commit is contained in:
parent
24156a249e
commit
ad7448ad40
1 changed files with 14 additions and 8 deletions
|
|
@ -111,10 +111,14 @@ func Index(w http.ResponseWriter, r *http.Request, idx v1.ImageIndex, also ...st
|
|||
}
|
||||
|
||||
for _, a := range also {
|
||||
log.Printf("writing index manifest %q also to %q", digest, a)
|
||||
if err := writeBlob(a, digest, ioutil.NopCloser(bytes.NewReader(b)), string(mt)); err != nil {
|
||||
return err
|
||||
}
|
||||
a := a
|
||||
g.Go(func() error {
|
||||
log.Printf("writing index manifest %q also to %q", digest, a)
|
||||
return writeBlob(a, digest, ioutil.NopCloser(bytes.NewReader(b)), string(mt))
|
||||
})
|
||||
}
|
||||
if err := g.Wait(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Redirect to manifest blob.
|
||||
|
|
@ -181,11 +185,13 @@ func writeImage(img v1.Image, also ...string) error {
|
|||
return err
|
||||
}
|
||||
for _, a := range also {
|
||||
log.Printf("writing image manifest %q also to %q", digest, a)
|
||||
if err := writeBlob(a, digest, ioutil.NopCloser(bytes.NewReader(b)), string(mt)); err != nil {
|
||||
return err
|
||||
}
|
||||
a := a
|
||||
g.Go(func() error {
|
||||
log.Printf("writing image manifest %q also to %q", digest, a)
|
||||
return writeBlob(a, digest, ioutil.NopCloser(bytes.NewReader(b)), string(mt))
|
||||
})
|
||||
}
|
||||
return g.Wait()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue