"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "vendor/github.com/moby/buildkit/util/resolver/retryhandler/retry.go" between
moby-20.10.6.tar.gz and moby-20.10.7.tar.gz

About: Moby is a framework to assemble specialized container systems (formerly project name Docker; see here to clarify the relationship between the projects).

retry.go  (moby-20.10.6):retry.go  (moby-20.10.7)
skipping to change at line 12 skipping to change at line 12
import ( import (
"context" "context"
"fmt" "fmt"
"io" "io"
"strings" "strings"
"syscall" "syscall"
"time" "time"
"github.com/containerd/containerd/images" "github.com/containerd/containerd/images"
remoteserrors "github.com/containerd/containerd/remotes/errors"
ocispec "github.com/opencontainers/image-spec/specs-go/v1" ocispec "github.com/opencontainers/image-spec/specs-go/v1"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc { func New(f images.HandlerFunc, logger func([]byte)) images.HandlerFunc {
return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Desc riptor, error) { return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Desc riptor, error) {
backoff := time.Second backoff := time.Second
for { for {
descs, err := f(ctx, desc) descs, err := f(ctx, desc)
if err != nil { if err != nil {
skipping to change at line 50 skipping to change at line 51
if logger != nil { if logger != nil {
logger([]byte(fmt.Sprintf("retrying in %v\n", bac koff))) logger([]byte(fmt.Sprintf("retrying in %v\n", bac koff)))
} }
time.Sleep(backoff) time.Sleep(backoff)
backoff *= 2 backoff *= 2
} }
} }
} }
func retryError(err error) bool { func retryError(err error) bool {
// Retry on 5xx errors
var errUnexpectedStatus remoteserrors.ErrUnexpectedStatus
if errors.As(err, &errUnexpectedStatus) &&
errUnexpectedStatus.StatusCode >= 500 &&
errUnexpectedStatus.StatusCode <= 599 {
return true
}
if errors.Is(err, io.EOF) || errors.Is(err, syscall.ECONNRESET) || errors .Is(err, syscall.EPIPE) { if errors.Is(err, io.EOF) || errors.Is(err, syscall.ECONNRESET) || errors .Is(err, syscall.EPIPE) {
return true return true
} }
// https://github.com/containerd/containerd/pull/4724 // https://github.com/containerd/containerd/pull/4724
if errors.Cause(err).Error() == "no response" { if errors.Cause(err).Error() == "no response" {
return true return true
} }
// net.ErrClosed exposed in go1.16 // net.ErrClosed exposed in go1.16
if strings.Contains(err.Error(), "use of closed network connection") { if strings.Contains(err.Error(), "use of closed network connection") {
 End of changes. 2 change blocks. 
0 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)