Skip to content

Instantly share code, notes, and snippets.

@mklemme
Forked from jlxw/gist:3357795
Created October 16, 2015 20:38
Show Gist options
  • Save mklemme/0635e6b030eec98c7738 to your computer and use it in GitHub Desktop.
Save mklemme/0635e6b030eec98c7738 to your computer and use it in GitHub Desktop.

Revisions

  1. @jlxw jlxw created this gist Aug 15, 2012.
    17 changes: 17 additions & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    ExceptionNotifier::Notifier.class_eval do
    #https://github.com/smartinez87/exception_notification/blob/master/lib/exception_notifier/notifier.rb
    def self.exception_notification(*args)
    message = super

    _limit = 5.minutes.ago
    @@last_notification||=_limit
    if @@last_notification > _limit
    Rails.logger.info "ExceptionNotifier rate limit triggered, #{ExceptionNotifier::Notifier.deliveries.size} notifications limited."
    message.delivery_method :test
    else
    @@last_notification = Time.now
    end

    message
    end
    end