From a3c1007d4746a737994eac22fd41ae8b4af42b4b Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 5 Jun 2023 11:21:45 +0200 Subject: [PATCH] retry.Retryable(): treat ENOENT (AF_UNIX) like ECONNREFUSED, i.e. also 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. --- pkg/retry/retry.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/retry/retry.go b/pkg/retry/retry.go index 0364bbcf..1e16b6f1 100644 --- a/pkg/retry/retry.go +++ b/pkg/retry/retry.go @@ -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) {