Class: Gitlab::Mailgun::WebhookProcessors::FailureLogger

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/mailgun/webhook_processors/failure_logger.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Mailgun::WebhookProcessors::Base

Instance Method Details

#executeObject



7
8
9
# File 'lib/gitlab/mailgun/webhook_processors/failure_logger.rb', line 7

def execute
  log_failure if permanent_failure_over_threshold? || temporary_failure_over_threshold?
end

#permanent_failure_over_threshold?Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/gitlab/mailgun/webhook_processors/failure_logger.rb', line 11

def permanent_failure_over_threshold?
  payload['event'] == 'failed' && payload['severity'] == 'permanent' &&
    Gitlab::ApplicationRateLimiter.throttled?(:permanent_email_failure, scope: payload['recipient'])
end

#temporary_failure_over_threshold?Boolean

Returns:

  • (Boolean)


16
17
18
19
# File 'lib/gitlab/mailgun/webhook_processors/failure_logger.rb', line 16

def temporary_failure_over_threshold?
  payload['event'] == 'failed' && payload['severity'] == 'temporary' &&
    Gitlab::ApplicationRateLimiter.throttled?(:temporary_email_failure, scope: payload['recipient'])
end