Class: Racknga::ExceptionMailNotifier — racknga - ラングバ

Class: Racknga::ExceptionMailNotifier

Inherits:
Object
  • Object
show all
Defined in:
lib/racknga/exception_mail_notifier.rb

Overview

Ruby 1.9 only. 1.8 isn’t supported.

Constant Summary

DEFAULT_MAX_MAIL_COUNT_IN_LIMIT_DURATION =
2
DEFAULT_LIMIT_DURATION =

one minute

60

Instance Method Summary (collapse)

Constructor Details

- (ExceptionMailNotifier) initialize(options)

A new instance of ExceptionMailNotifier



30
31
32
33
# File 'lib/racknga/exception_mail_notifier.rb', line 30

def initialize(options)
  @options = Utils.normalize_options(options || {})
  reset_limitation
end

Instance Method Details

- (Object) notify(exception, environment)



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/racknga/exception_mail_notifier.rb', line 35

def notify(exception, environment)
  return if to.empty?

  if limitation_expired?
    send_summaries unless @summaries.empty?
    reset_limitation
  end

  if @mail_count < max_mail_count_in_limit_duration
    send_notification(exception, environment)
  else
    @summaries << summarize(exception, environment)
  end

  @mail_count += 1
end