class ResumableJob::Backoff
Constants
- DEFAULT_BASE_IN_MINUTES
- SECONDS_PER_MINUTE
Attributes
attempt[RW]
base[RW]
Public Class Methods
new(attempt, base: DEFAULT_BASE_IN_MINUTES)
click to toggle source
# File lib/resumable_job/backoff.rb, line 20 def initialize(attempt, base: DEFAULT_BASE_IN_MINUTES) self.attempt = attempt self.base = base end
to_i(*args)
click to toggle source
# File lib/resumable_job/backoff.rb, line 7 def to_i(*args) new(*args).to_i end
to_time(*args)
click to toggle source
# File lib/resumable_job/backoff.rb, line 11 def to_time(*args) new(*args).to_time end
Public Instance Methods
to_i()
click to toggle source
# File lib/resumable_job/backoff.rb, line 16 def to_i to_time.to_i end
to_time()
click to toggle source
# File lib/resumable_job/backoff.rb, line 25 def to_time Time.now + delay end
Private Instance Methods
delay()
click to toggle source
# File lib/resumable_job/backoff.rb, line 33 def delay (2**attempt) * base * SECONDS_PER_MINUTE end