From a80fee3343f12028079ae831a04b9583ba09c695 Mon Sep 17 00:00:00 2001 From: Garen Chan <1412950785@qq.com> Date: Tue, 2 Aug 2022 01:38:54 +0800 Subject: [PATCH] fix: remote target is permanently marked offline by mistake (#1684) --- api.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/api.go b/api.go index ec91df934..4dfdbd1d9 100644 --- a/api.go +++ b/api.go @@ -384,13 +384,11 @@ func (c *Client) HealthCheck(hcDuration time.Duration) (context.CancelFunc, erro gctx, gcancel := context.WithTimeout(context.Background(), 3*time.Second) _, err := c.getBucketLocation(gctx, probeBucketName) gcancel() - if IsNetworkOrHostDown(err, false) { - // Still network errors do not need to do anything. - continue - } - switch ToErrorResponse(err).Code { - case "NoSuchBucket", "AccessDenied", "": - atomic.CompareAndSwapInt32(&c.healthStatus, offline, online) + if !IsNetworkOrHostDown(err, false) { + switch ToErrorResponse(err).Code { + case "NoSuchBucket", "AccessDenied", "": + atomic.CompareAndSwapInt32(&c.healthStatus, offline, online) + } } }