mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
rafthttp: log health checking error early
This commit is contained in:
parent
5a83f05e96
commit
9311d7b77e
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user