|
@@ -25,6 +25,7 @@ var (
|
|
|
// Or the connection will time-out.
|
|
// Or the connection will time-out.
|
|
|
proberInterval = ConnReadTimeout - time.Second
|
|
proberInterval = ConnReadTimeout - time.Second
|
|
|
statusMonitoringInterval = 30 * time.Second
|
|
statusMonitoringInterval = 30 * time.Second
|
|
|
|
|
+ statusErrorInterval = 5 * time.Second
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func addPeerToProber(p probing.Prober, id string, us []string) {
|
|
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) {
|
|
func monitorProbingStatus(s probing.Status, id string) {
|
|
|
|
|
+ // set the first interval short to log error early.
|
|
|
|
|
+ interval := statusErrorInterval
|
|
|
for {
|
|
for {
|
|
|
select {
|
|
select {
|
|
|
- case <-time.After(statusMonitoringInterval):
|
|
|
|
|
|
|
+ case <-time.After(interval):
|
|
|
if !s.Health() {
|
|
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 {
|
|
if s.ClockDiff() > time.Second {
|
|
|
plog.Warningf("the clock difference against peer %s is too high [%v > %v]", id, s.ClockDiff(), time.Second)
|
|
plog.Warningf("the clock difference against peer %s is too high [%v > %v]", id, s.ClockDiff(), time.Second)
|