Class: Forked::RetryStrategies::Always

Inherits:
Object
  • Object
show all
Defined in:
lib/forked/retry_strategies/always.rb

Overview

Relies on the master restarting the worker process

Instance Method Summary collapse

Constructor Details

#initialize(logger:, on_error:) ⇒ Always

Returns a new instance of Always.



5
6
7
8
# File 'lib/forked/retry_strategies/always.rb', line 5

def initialize(logger:, on_error:)
  @logger = logger
  @on_error = on_error
end

Instance Method Details

#run(ready_to_stop, &block) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/forked/retry_strategies/always.rb', line 10

def run(ready_to_stop, &block)
  block.call
rescue => e
  @logger.error("#{e.class} #{e.message}")
  @on_error.call(e, 1)
  raise
end