From 9b69cf2c36140bc9de9976286e46866211bb17a3 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 23 Nov 2012 15:39:22 +0000 Subject: Missed the fact that the alert group was being looked up earlier in Notifier#notify. --- lib/mauve/notifier.rb | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/mauve/notifier.rb b/lib/mauve/notifier.rb index d433e96..35ac019 100644 --- a/lib/mauve/notifier.rb +++ b/lib/mauve/notifier.rb @@ -41,17 +41,24 @@ module Mauve # alert.reload - if alert.alert_group.nil? + # + # Forces alert-group to be re-evaluated on notification. + # + alert.cached_alert_group = nil + this_alert_group = alert.alert_group + + # + # This saves without callbacks if the cached_alert_group has been + # altered. + # + alert.save! if alert.dirty? + + if this_alert_group.nil? logger.warn "Could not notify for #{alert} since there are no matching alert groups" else - # Forces alert-group to be re-evaluated on notification. - alert.cached_alert_group = nil - alert.alert_group.notify(alert, at) - # - # This saves without callbacks if the alert has been altered. - # - alert.save! if alert.dirty? + this_alert_group.notify(alert, at) + end end -- cgit v1.2.1