mirror of
https://github.com/minio/minio.git
synced 2025-11-07 04:42:56 -05:00
Reduce health check output (#10859)
This will make the health check clients 'silent'. Use `IsNetworkOrHostDown` determine if network is ok so it mimics the functionality in the actual client.
This commit is contained in:
@@ -615,15 +615,17 @@ func newStorageRESTClient(endpoint Endpoint, healthcheck bool) *storageRESTClien
|
||||
}
|
||||
|
||||
restClient := rest.NewClient(serverURL, globalInternodeTransport, newAuthToken)
|
||||
|
||||
if healthcheck {
|
||||
// Use a separate client to avoid recursive calls.
|
||||
healthClient := rest.NewClient(serverURL, globalInternodeTransport, newAuthToken)
|
||||
healthClient.ExpectTimeouts = true
|
||||
restClient.HealthCheckFn = func() bool {
|
||||
ctx, cancel := context.WithTimeout(GlobalContext, restClient.HealthCheckTimeout)
|
||||
// Instantiate a new rest client for healthcheck
|
||||
// to avoid recursive healthCheckFn()
|
||||
respBody, err := rest.NewClient(serverURL, globalInternodeTransport, newAuthToken).Call(ctx, storageRESTMethodHealth, nil, nil, -1)
|
||||
respBody, err := healthClient.Call(ctx, storageRESTMethodHealth, nil, nil, -1)
|
||||
xhttp.DrainBody(respBody)
|
||||
cancel()
|
||||
return !errors.Is(err, context.DeadlineExceeded) && toStorageErr(err) != errDiskNotFound
|
||||
return !xnet.IsNetworkOrHostDown(err, false) && toStorageErr(err) != errDiskNotFound
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user