mirror of
https://github.com/containers/podman.git
synced 2025-12-08 14:48:48 +08:00
vendor: bump c/common to 9b0d134f392
Bump common to 9b0d134f392f41de3f3065aad162e73a3904168e Signed-off-by: flouthoc <flouthoc.git@gmail.com>
This commit is contained in:
11
vendor/github.com/containers/common/pkg/retry/retry.go
generated
vendored
11
vendor/github.com/containers/common/pkg/retry/retry.go
generated
vendored
@@ -5,10 +5,12 @@ import (
|
||||
"io"
|
||||
"math"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containers/image/v5/docker"
|
||||
"github.com/docker/distribution/registry/api/errcode"
|
||||
errcodev2 "github.com/docker/distribution/registry/api/v2"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
@@ -47,7 +49,7 @@ func IfNecessary(ctx context.Context, operation func() error, options *Options)
|
||||
logrus.Warnf("Failed, retrying in %s ... (%d/%d). Error: %v", delay, attempt+1, options.MaxRetry, err)
|
||||
select {
|
||||
case <-time.After(delay):
|
||||
break
|
||||
// Do nothing.
|
||||
case <-ctx.Done():
|
||||
return err
|
||||
}
|
||||
@@ -81,6 +83,13 @@ func IsErrorRetryable(err error) bool {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
case docker.UnexpectedHTTPStatusError:
|
||||
// Retry on 502, 502 and 503 http server errors, they appear to be quite common in the field.
|
||||
// https://github.com/containers/common/issues/2299
|
||||
if e.StatusCode >= http.StatusBadGateway && e.StatusCode <= http.StatusGatewayTimeout {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
case *net.OpError:
|
||||
return IsErrorRetryable(e.Err)
|
||||
case *url.Error: // This includes errors returned by the net/http client.
|
||||
|
||||
Reference in New Issue
Block a user