From 9a02180c2aa902d41d142cf7faead4029bc641e3 Mon Sep 17 00:00:00 2001 From: Patrick J Cherry Date: Fri, 23 Nov 2012 10:23:01 +0000 Subject: Alerts only saved on notificaion if the cached_alert_group has changed. Also the save! method is now used to avoid the callbacks which might trigger further notifications. --- lib/mauve/notifier.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mauve/notifier.rb b/lib/mauve/notifier.rb index 67cd89b..acbbab4 100644 --- a/lib/mauve/notifier.rb +++ b/lib/mauve/notifier.rb @@ -41,7 +41,10 @@ module Mauve logger.warn "Could not notify for #{alert} since there are no matching alert groups" else alert.alert_group.notify(alert, at) - alert.save if alert.is_a?(Alert) + # + # This saves without callbacks. + # + alert.save! if alert.is_a?(Alert) and alert.original_attributes.has_key?("cached_alert_group") end end -- cgit v1.2.1