Module: RetryHandler
- Defined in:
- lib/retry-handler.rb
Constant Summary collapse
- DEFAULT_MAX_RETRY =
3
- DEFAULT_WAIT_TIME =
1
- INFINITY_EXECUTE =
nil
Class Method Summary collapse
Class Method Details
.retry_handler(options = {}, &block) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/retry-handler.rb', line 12 def self.retry_handler(={}, &block) max = [:max] || DEFAULT_MAX_RETRY wait = [:wait] || DEFAULT_WAIT_TIME timeout = [:timeout] || INFINITY_EXECUTE exception = [:accept_exception] || RetryError logger = [:logger] || Logger.new(nil) _retry_handler(max, wait, exception, logger) do timeout(timeout, RetryError) do block.call end end end |