Method: FFWD::Retrier#try_block

Defined in:
lib/ffwd/retrier.rb

#try_blockObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ffwd/retrier.rb', line 52

def try_block
  @attempt += 1
  @block.call @attempt
  @current_timeout = @timeout
rescue => e
  @error_callbacks.each do |block|
    block.call @attempt, @current_timeout, e
  end

  @timer = EM::Timer.new(@current_timeout) do
    @current_timeout *= 2 unless @current_timeout >= @max_timeout
    @timer = nil
    try_block
  end
end