diff options
author | Rasmus Dahlberg <rasmus@rgdd.se> | 2025-01-03 21:40:01 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus@rgdd.se> | 2025-01-03 21:40:01 +0100 |
commit | 28c63951c32e12111d407ee7c5e34f864315f850 (patch) | |
tree | 5d350d924a32f9be6c399805d498087bc0a28429 /internal/manager | |
parent | 084fa766dd4201b186ec7362e494d7d82c398acd (diff) |
Ensure alertJob() runs on the clock
Currently it only runs if there are monitor/feedback events. Which is
probably fine for the most part, but will be a bit more robust.
Diffstat (limited to 'internal/manager')
-rw-r--r-- | internal/manager/manager.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/internal/manager/manager.go b/internal/manager/manager.go index dcb1a37..f8b05fd 100644 --- a/internal/manager/manager.go +++ b/internal/manager/manager.go @@ -82,6 +82,9 @@ func (mgr *Manager) Run(ctx context.Context) error { metadataTicker := time.NewTicker(mgr.MetadataRefreshInterval) defer metadataTicker.Stop() + alertTicker := time.NewTicker(mgr.AlertDelay) + defer alertTicker.Stop() + shutdown := false for { select { @@ -89,6 +92,10 @@ func (mgr *Manager) Run(ctx context.Context) error { if err := mgr.metadataJob(ctx); err != nil { return fmt.Errorf("unable to run metadata job: %v", err) } + case <-alertTicker.C: + if err := mgr.alertJob(); err != nil { + return fmt.Errorf("unable to run alert job: %v\n", err) + } case ev := <-mgr.meventCh: if err := mgr.monitorJob(ev); err != nil { return fmt.Errorf("unable to run monitor job: %v", err) |