From b97d53b29c871f45cee9ca160b6772b36c69f2c8 Mon Sep 17 00:00:00 2001 From: Poorna Krishnamoorthy Date: Tue, 12 Jan 2021 20:48:04 -0800 Subject: [PATCH] fix remote target healthcheck (#11267) --- cmd/bucket-targets.go | 10 +++++----- docs/bucket/replication/README.md | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/bucket-targets.go b/cmd/bucket-targets.go index 8f9f1522e..645864e55 100644 --- a/cmd/bucket-targets.go +++ b/cmd/bucket-targets.go @@ -367,9 +367,9 @@ func (sys *BucketTargetSys) getRemoteTargetClient(tcfg *madmin.BucketTarget) (*T if err != nil { return nil, err } - hcDuration := tcfg.HealthCheckDuration - if hcDuration < 1 { // require minimum health check duration of 1 sec. - hcDuration = defaultHealthCheckDuration + hcDuration := defaultHealthCheckDuration + if tcfg.HealthCheckDuration >= 1 { // require minimum health check duration of 1 sec. + hcDuration = tcfg.HealthCheckDuration } tc := &TargetClient{ Client: api, @@ -461,10 +461,10 @@ func (tc *TargetClient) healthCheck() { _, err := tc.BucketExists(GlobalContext, tc.bucket) if err != nil { atomic.StoreInt32(&tc.up, 0) - time.Sleep(tc.healthCheckDuration) + time.Sleep(tc.healthCheckDuration * time.Second) continue } atomic.StoreInt32(&tc.up, 1) - time.Sleep(tc.healthCheckDuration) + time.Sleep(tc.healthCheckDuration * time.Second) } } diff --git a/docs/bucket/replication/README.md b/docs/bucket/replication/README.md index 2b59ce48a..29b9be491 100644 --- a/docs/bucket/replication/README.md +++ b/docs/bucket/replication/README.md @@ -159,7 +159,7 @@ an upcoming feature. By default, replication is completed asynchronously. If synchronous replication is desired, set the --sync flag while adding a remote replication target using the `mc admin bucket remote add` command ``` - mc admin bucket remote add myminio/srcbucket https://accessKey:secretKey@replica-endpoint:9000/destbucket --service replication --region us-east-1 --sync --healthcheck-seconds 100s + mc admin bucket remote add myminio/srcbucket https://accessKey:secretKey@replica-endpoint:9000/destbucket --service replication --region us-east-1 --sync --healthcheck-seconds 100 ``` ## Explore Further