Skip to content

Commit

Permalink
retry.Retryable(): treat ENOENT (AF_UNIX) like ECONNREFUSED, i.e. als…
Browse files Browse the repository at this point in the history
…o retry

During connect(2) we may get ECONNREFUSED between server's bind(2) and
listen(2), but the most downtime between boot and service start the socket
won't exist, yet. I.e. ENOENT is the de facto ECONNREFUSED of *nix sockets.
  • Loading branch information
Al2Klimov committed Jun 5, 2023
1 parent 4ed4db3 commit a3c1007
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/retry/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func Retryable(err error) bool {
// which is not considered temporary or timed out by Go.
err = opError.Err
}
if errors.Is(err, syscall.ECONNREFUSED) {
if errors.Is(err, syscall.ECONNREFUSED) || errors.Is(err, syscall.ENOENT) {
// syscall errors provide Temporary() and Timeout(),
// which do not include ECONNREFUSED, so we check this ourselves.
// which do not include ECONNREFUSED or ENOENT, so we check these ourselves.
return true
}
if errors.Is(err, syscall.ECONNRESET) {
Expand Down

0 comments on commit a3c1007

Please sign in to comment.