diff --git a/rafthttp/probing_status.go b/rafthttp/probing_status.go index edb50a7cc..c7a3c7ab9 100644 --- a/rafthttp/probing_status.go +++ b/rafthttp/probing_status.go @@ -25,6 +25,7 @@ var ( // Or the connection will time-out. proberInterval = ConnReadTimeout - time.Second statusMonitoringInterval = 30 * time.Second + statusErrorInterval = 5 * time.Second ) func addPeerToProber(p probing.Prober, id string, us []string) { @@ -44,11 +45,16 @@ func addPeerToProber(p probing.Prober, id string, us []string) { } func monitorProbingStatus(s probing.Status, id string) { + // set the first interval short to log error early. + interval := statusErrorInterval for { select { - case <-time.After(statusMonitoringInterval): + case <-time.After(interval): if !s.Health() { - plog.Warningf("health check for peer %s could not connect", id) + plog.Warningf("health check for peer %s could not connect: %v", id, s.Err()) + interval = statusErrorInterval + } else { + interval = statusMonitoringInterval } if s.ClockDiff() > time.Second { plog.Warningf("the clock difference against peer %s is too high [%v > %v]", id, s.ClockDiff(), time.Second)