Backoff retry on verification to give s3 time to propagate
Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
parent
4f41f0be06
commit
36ffe0c134
1 changed files with 3 additions and 3 deletions
|
@ -59,8 +59,8 @@ func (lw *layerWriter) Finish(dgst digest.Digest) (distribution.Layer, error) {
|
||||||
)
|
)
|
||||||
|
|
||||||
// HACK(stevvooe): To deal with s3's lack of consistency, attempt to retry
|
// HACK(stevvooe): To deal with s3's lack of consistency, attempt to retry
|
||||||
// validation on failure. Three attempts are made, backing off 100ms each
|
// validation on failure. Three attempts are made, backing off
|
||||||
// time.
|
// retries*100ms each time.
|
||||||
for retries := 0; ; retries++ {
|
for retries := 0; ; retries++ {
|
||||||
canonical, err = lw.validateLayer(dgst)
|
canonical, err = lw.validateLayer(dgst)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -71,7 +71,7 @@ func (lw *layerWriter) Finish(dgst digest.Digest) (distribution.Layer, error) {
|
||||||
Errorf("error validating layer: %v", err)
|
Errorf("error validating layer: %v", err)
|
||||||
|
|
||||||
if retries < 3 {
|
if retries < 3 {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond * time.Duration(retries+1))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue