From 16c03352da39fd64cfe5aea6eba3103e9746fc8b Mon Sep 17 00:00:00 2001 From: Craig Peterson Date: Wed, 10 Feb 2016 10:29:11 -0700 Subject: [PATCH] cmd/bosun: fixing bug with chained notifications. Fixes #1583 --- cmd/bosun/sched/bolt.go | 1 + cmd/bosun/sched/notify.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/bosun/sched/bolt.go b/cmd/bosun/sched/bolt.go index 81a629903c..bcc2a3577b 100644 --- a/cmd/bosun/sched/bolt.go +++ b/cmd/bosun/sched/bolt.go @@ -142,6 +142,7 @@ func (s *Schedule) RestoreState() error { if err := decode(db, dbNotifications, ¬ifications); err != nil { slog.Errorln(dbNotifications, err) } + s.Notifications = notifications //status := make(States) // if err := decode(db, dbStatus, &status); err != nil { diff --git a/cmd/bosun/sched/notify.go b/cmd/bosun/sched/notify.go index 5107be0b3f..fb756062bc 100644 --- a/cmd/bosun/sched/notify.go +++ b/cmd/bosun/sched/notify.go @@ -15,13 +15,13 @@ import ( func (s *Schedule) dispatchNotifications() { ticker := time.NewTicker(s.Conf.CheckFrequency * 2) - timeout := s.CheckNotifications() + nextScheduled := time.After(s.CheckNotifications()) for { select { - case <-time.After(timeout): - timeout = s.CheckNotifications() + case <-nextScheduled: + nextScheduled = time.After(s.CheckNotifications()) case <-s.nc: - timeout = s.CheckNotifications() + nextScheduled = time.After(s.CheckNotifications()) case <-ticker.C: s.sendUnknownNotifications() }