Class: ResumableJob::Backoff
- Inherits:
-
Object
- Object
- ResumableJob::Backoff
- Defined in:
- lib/resumable_job/backoff.rb
Constant Summary collapse
- DEFAULT_BASE_IN_MINUTES =
1
- SECONDS_PER_MINUTE =
60
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attempt, base: DEFAULT_BASE_IN_MINUTES) ⇒ Backoff
constructor
A new instance of Backoff.
- #to_i ⇒ Object
- #to_time ⇒ Object
Constructor Details
#initialize(attempt, base: DEFAULT_BASE_IN_MINUTES) ⇒ Backoff
Returns a new instance of Backoff.
20 21 22 23 |
# File 'lib/resumable_job/backoff.rb', line 20 def initialize(attempt, base: DEFAULT_BASE_IN_MINUTES) self.attempt = attempt self.base = base end |
Class Method Details
.to_i(*args) ⇒ Object
7 8 9 |
# File 'lib/resumable_job/backoff.rb', line 7 def to_i(*args) new(*args).to_i end |
.to_time(*args) ⇒ Object
11 12 13 |
# File 'lib/resumable_job/backoff.rb', line 11 def to_time(*args) new(*args).to_time end |
Instance Method Details
#to_i ⇒ Object
16 17 18 |
# File 'lib/resumable_job/backoff.rb', line 16 def to_i to_time.to_i end |
#to_time ⇒ Object
25 26 27 |
# File 'lib/resumable_job/backoff.rb', line 25 def to_time Time.now + delay end |