mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
commit
bdeb96be0f
@ -772,9 +772,9 @@ func (s *PeerServer) startRoutine(f func()) {
|
|||||||
func (s *PeerServer) monitorSnapshot() {
|
func (s *PeerServer) monitorSnapshot() {
|
||||||
for {
|
for {
|
||||||
timer := time.NewTimer(s.snapConf.checkingInterval)
|
timer := time.NewTimer(s.snapConf.checkingInterval)
|
||||||
defer timer.Stop()
|
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
|
timer.Stop()
|
||||||
return
|
return
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
}
|
}
|
||||||
@ -807,6 +807,8 @@ func (s *PeerServer) monitorSync() {
|
|||||||
// monitorTimeoutThreshold groups timeout threshold events together and prints
|
// monitorTimeoutThreshold groups timeout threshold events together and prints
|
||||||
// them as a single log line.
|
// them as a single log line.
|
||||||
func (s *PeerServer) monitorTimeoutThreshold() {
|
func (s *PeerServer) monitorTimeoutThreshold() {
|
||||||
|
ticker := time.NewTicker(ThresholdMonitorTimeout)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
@ -815,12 +817,10 @@ func (s *PeerServer) monitorTimeoutThreshold() {
|
|||||||
log.Infof("%s: warning: heartbeat near election timeout: %v", s.Config.Name, value)
|
log.Infof("%s: warning: heartbeat near election timeout: %v", s.Config.Name, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
timer := time.NewTimer(ThresholdMonitorTimeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
return
|
return
|
||||||
case <-timer.C:
|
case <-ticker.C:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -828,13 +828,13 @@ func (s *PeerServer) monitorTimeoutThreshold() {
|
|||||||
// monitorActiveSize has the leader periodically check the status of cluster
|
// monitorActiveSize has the leader periodically check the status of cluster
|
||||||
// nodes and swaps them out for standbys as needed.
|
// nodes and swaps them out for standbys as needed.
|
||||||
func (s *PeerServer) monitorActiveSize() {
|
func (s *PeerServer) monitorActiveSize() {
|
||||||
|
ticker := time.NewTicker(ActiveMonitorTimeout)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
timer := time.NewTimer(ActiveMonitorTimeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
return
|
return
|
||||||
case <-timer.C:
|
case <-ticker.C:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore while this peer is not a leader.
|
// Ignore while this peer is not a leader.
|
||||||
@ -864,13 +864,13 @@ func (s *PeerServer) monitorActiveSize() {
|
|||||||
|
|
||||||
// monitorPeerActivity has the leader periodically for dead nodes and demotes them.
|
// monitorPeerActivity has the leader periodically for dead nodes and demotes them.
|
||||||
func (s *PeerServer) monitorPeerActivity() {
|
func (s *PeerServer) monitorPeerActivity() {
|
||||||
|
ticker := time.NewTicker(PeerActivityMonitorTimeout)
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
timer := time.NewTimer(PeerActivityMonitorTimeout)
|
|
||||||
defer timer.Stop()
|
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
return
|
return
|
||||||
case <-timer.C:
|
case <-ticker.C:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore while this peer is not a leader.
|
// Ignore while this peer is not a leader.
|
||||||
|
@ -178,13 +178,13 @@ func (s *StandbyServer) redirectRequests(w http.ResponseWriter, r *http.Request)
|
|||||||
// monitorCluster assumes that the machine has tried to join the cluster and
|
// monitorCluster assumes that the machine has tried to join the cluster and
|
||||||
// failed, so it waits for the interval at the beginning.
|
// failed, so it waits for the interval at the beginning.
|
||||||
func (s *StandbyServer) monitorCluster() {
|
func (s *StandbyServer) monitorCluster() {
|
||||||
|
ticker := time.NewTicker(time.Duration(int64(s.SyncInterval * float64(time.Second))))
|
||||||
|
defer ticker.Stop()
|
||||||
for {
|
for {
|
||||||
timer := time.NewTimer(time.Duration(int64(s.SyncInterval * float64(time.Second))))
|
|
||||||
defer timer.Stop()
|
|
||||||
select {
|
select {
|
||||||
case <-s.closeChan:
|
case <-s.closeChan:
|
||||||
return
|
return
|
||||||
case <-timer.C:
|
case <-ticker.C:
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.syncCluster(nil); err != nil {
|
if err := s.syncCluster(nil); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user