Class: ProconBypassMan::Retryable
- Inherits:
-
Object
- Object
- ProconBypassMan::Retryable
- Defined in:
- lib/procon_bypass_man/support/retryable.rb
Class Method Summary collapse
Class Method Details
.retryable(tries:, retried: 0, on_no_retry: [], log_label: nil, interval_on_retry: 0) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/procon_bypass_man/support/retryable.rb', line 3 def self.retryable(tries: , retried: 0, on_no_retry: [], log_label: nil, interval_on_retry: 0) return yield(retried) rescue *on_no_retry raise rescue => e if tries <= retried raise else retried = retried + 1 ProconBypassMan.logger.debug "[Retryable]#{log_label && "[#{log_label}]"} #{e}が起きました。retryします。#{retried} / #{tries}" sleep(interval_on_retry) retry end end |