Skip to content

Commit

Permalink
fix: remote target is permanently marked offline by mistake (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
garenchan committed Aug 1, 2022
1 parent 399e775 commit a80fee3
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}

Expand Down

0 comments on commit a80fee3

Please sign in to comment.