Class: Lambdakiq::Backoff

Inherits:
Object
  • Object
show all
Defined in:
lib/lambdakiq/backoff.rb

Constant Summary collapse

MAX_VISIBILITY_TIMEOUT =

12 Hours

43200

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(count) ⇒ Backoff

Returns a new instance of Backoff.



16
17
18
# File 'lib/lambdakiq/backoff.rb', line 16

def initialize(count)
  @count = count
end

Instance Attribute Details

#countObject (readonly)

Returns the value of attribute count.



6
7
8
# File 'lib/lambdakiq/backoff.rb', line 6

def count
  @count
end

Class Method Details

.backoff(count) ⇒ Object



10
11
12
# File 'lib/lambdakiq/backoff.rb', line 10

def backoff(count)
  new(count).backoff
end

Instance Method Details

#backoffObject

From Sidekiq: git.io/fhi5O



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/lambdakiq/backoff.rb', line 22

def backoff
  case count
  when 1 then 30
  when 2 then 46
  when 3 then 76
  when 4 then 156
  when 5 then 346
  when 6 then 730
  when 7 then 1416
  when 8 then 2536
  when 9 then 4246
  when 10 then 6726
  when 11 then 10180
  when 12 then 14836
  end
end