observer: Monitors probe immediately instead of waiting a full duration (#6594)
Do work on startup to limit the likelihood of post-deployment runtime panics.
This commit is contained in:
parent
0d6f8569c5
commit
7d3fc60271
|
|
@ -18,8 +18,8 @@ type monitor struct {
|
|||
func (m monitor) start(logger blog.Logger) {
|
||||
ticker := time.NewTicker(m.period)
|
||||
timeout := m.period / 2
|
||||
go func() {
|
||||
for range ticker.C {
|
||||
for {
|
||||
go func() {
|
||||
// Attempt to probe the configured target.
|
||||
success, dur := m.prober.Probe(timeout)
|
||||
|
||||
|
|
@ -32,6 +32,7 @@ func (m monitor) start(logger blog.Logger) {
|
|||
logger.Infof(
|
||||
"kind=[%s] success=[%v] duration=[%f] name=[%s]",
|
||||
m.prober.Kind(), success, dur.Seconds(), m.prober.Name())
|
||||
}
|
||||
}()
|
||||
}()
|
||||
<-ticker.C
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue