feat: change behaviour

Do not return event with ok status on first
run of check. Will only return check result if
anything went wrong.
This commit is contained in:
2025-09-20 20:39:06 +03:00
parent 6b711756af
commit 214fda877e
2 changed files with 12 additions and 10 deletions

View File

@@ -218,11 +218,8 @@ func (w *Watchdog) copyChecks() []Check {
}
func (w *Watchdog) startMonitoring(wdc *wdCheck) {
wdc.stop = make(chan struct{})
state := CheckResult{}
ticker := time.Tick(wdc.check.Interval)
c := wdc.check
// this method is called only with
@@ -243,6 +240,15 @@ func (w *Watchdog) startMonitoring(wdc *wdCheck) {
}
}()
state := CheckResult{
// if first run return anything
// other that OK, we'll report it
// if first run is OK, then we do not need to report
Status: StatusOK,
}
ticker := time.Tick(wdc.check.Interval)
for {
w.limiter <- struct{}{}