aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2012-11-23 10:23:01 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2012-11-23 10:23:01 +0000
commit9a02180c2aa902d41d142cf7faead4029bc641e3 (patch)
tree4d1225980fe859989b0c4ebb211828eba235863c
parentbbbab8945443be58e78c6c93522ce21ab74d3504 (diff)
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.
-rw-r--r--lib/mauve/notifier.rb5
1 files changed, 4 insertions, 1 deletions
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