diff --git a/cluster.go b/cluster.go index cf0090c0f..c972daadd 100644 --- a/cluster.go +++ b/cluster.go @@ -1702,22 +1702,24 @@ func confirmNodeDown(uri URI, log logger.Logger) bool { Host: uri.HostPort(), Path: "version", } - ctx, cancel := context.WithTimeout(context.Background(), confirmDownTimeout*time.Second) - defer cancel() req, err := http.NewRequest("GET", u.String(), nil) if err != nil { log.Printf("bad request:%s %s", u.String(), err) return false } - for i := 0; i < confirmDownRetries; i++ { + ctx, cancel := context.WithTimeout(context.Background(), confirmDownTimeout*time.Second) + defer cancel() resp, err := http.DefaultClient.Do(req.WithContext(ctx)) + var bod []byte if err == nil { + bod, err = ioutil.ReadAll(resp.Body) if resp.StatusCode == 200 { return false } } - log.Printf("NodeLeave Timeout with %s %d", uri.HostPort(), i) + + log.Printf("NodeLeave confirm with %s %d. err: '%v' bod: '%s'", uri.HostPort(), i, err, bod) time.Sleep(confirmDownSleep * time.Second) } return true