mirror of
https://github.com/minio/minio.git
synced 2025-04-01 02:03:42 -04:00
No retries if minio server is down/connection refused err (#11809)
This commit is contained in:
parent
eed3b66d98
commit
32b088a2ff
@ -34,6 +34,7 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||||
@ -340,7 +341,6 @@ var successStatus = []int{
|
|||||||
// delayed manner using a standard back off algorithm.
|
// delayed manner using a standard back off algorithm.
|
||||||
func (adm AdminClient) executeMethod(ctx context.Context, method string, reqData requestData) (res *http.Response, err error) {
|
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
|
var reqRetry = MaxRetry // Indicates how many times we can retry the request
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// close idle connections before returning, upon error.
|
// close idle connections before returning, upon error.
|
||||||
@ -365,6 +365,10 @@ func (adm AdminClient) executeMethod(ctx context.Context, method string, reqData
|
|||||||
// Initiate the request.
|
// Initiate the request.
|
||||||
res, err = adm.do(req)
|
res, err = adm.do(req)
|
||||||
if err != nil {
|
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 {
|
if err == context.Canceled || err == context.DeadlineExceeded {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user