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