mirror of
https://github.com/status-im/consul.git
synced 2025-01-22 11:40:06 +00:00
CheckMonitor runs forever and runs the first check immediately
This commit is contained in:
parent
a4201255df
commit
9e63d1fa32
@ -55,11 +55,15 @@ func (c *CheckMonitor) Stop() {
|
|||||||
|
|
||||||
// run is invoked by a goroutine to run until Stop() is called
|
// run is invoked by a goroutine to run until Stop() is called
|
||||||
func (c *CheckMonitor) run() {
|
func (c *CheckMonitor) run() {
|
||||||
select {
|
next := time.After(0)
|
||||||
case <-time.After(c.Interval):
|
for {
|
||||||
c.check()
|
select {
|
||||||
case <-c.stopCh:
|
case <-next:
|
||||||
return
|
c.check()
|
||||||
|
next = time.After(c.Interval)
|
||||||
|
case <-c.stopCh:
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user