Module: Lcms::Engine::RetryDelayed::RetryBackoffStrategy

Defined in:
app/jobs/concerns/lcms/engine/retry_delayed.rb

Constant Summary collapse

MIN_DELAY_MULTIPLIER =
1.0
MAX_DELAY_MULTIPLIER =
5.0
RETRY_DELAYES =
[30.seconds, 1.minute, 3.minutes, 7.minutes].freeze

Class Method Summary collapse

Class Method Details

.retry_delay(retry_attempt, _exception) ⇒ Object



21
22
23
# File 'app/jobs/concerns/lcms/engine/retry_delayed.rb', line 21

def self.retry_delay(retry_attempt, _exception)
  (RETRY_DELAYES[retry_attempt] || 0) * rand(MIN_DELAY_MULTIPLIER..MAX_DELAY_MULTIPLIER)
end

.should_retry?(retry_attempt, exception) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'app/jobs/concerns/lcms/engine/retry_delayed.rb', line 15

def self.should_retry?(retry_attempt, exception)
  return false if exception.message =~ /Script error message/ && exception.message =~ /PAGE_BREAK/

  retry_attempt <= RETRY_DELAYES.size
end