diff --git a/pkg/madmin/api.go b/pkg/madmin/api.go index d34a43579..1747ff65f 100644 --- a/pkg/madmin/api.go +++ b/pkg/madmin/api.go @@ -34,6 +34,7 @@ import ( "regexp" "runtime" "strings" + "syscall" "time" "github.com/minio/minio-go/v7/pkg/credentials" @@ -340,7 +341,6 @@ var successStatus = []int{ // delayed manner using a standard back off algorithm. func (adm AdminClient) executeMethod(ctx context.Context, method string, reqData requestData) (res *http.Response, err error) { var reqRetry = MaxRetry // Indicates how many times we can retry the request - defer func() { if err != nil { // close idle connections before returning, upon error. @@ -365,6 +365,10 @@ func (adm AdminClient) executeMethod(ctx context.Context, method string, reqData // Initiate the request. res, err = adm.do(req) if err != nil { + // Give up right away if it is a connection refused problem + if errors.Is(err, syscall.ECONNREFUSED) { + return nil, err + } if err == context.Canceled || err == context.DeadlineExceeded { return nil, err }