Merge pull request #2036 from earthly/vlad/retry

Retry on temporary network failures
v0.9
Akihiro Suda 2021-03-24 12:52:29 +09:00 committed by GitHub
commit 2219e6bf42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"net"
"strings"
"syscall"
"time"
@ -50,6 +51,10 @@ func retryError(err error) bool {
if errors.Is(err, io.EOF) || errors.Is(err, syscall.ECONNRESET) || errors.Is(err, syscall.EPIPE) {
return true
}
// catches TLS timeout or other network-related temporary errors
if ne, ok := errors.Cause(err).(net.Error); ok && ne.Temporary() {
return true
}
// https://github.com/containerd/containerd/pull/4724
if errors.Cause(err).Error() == "no response" {
return true