Class: IbmAppconfigurationRubySdk::RetryPolicy
- Inherits:
-
Object
- Object
- IbmAppconfigurationRubySdk::RetryPolicy
- Defined in:
- lib/ibm_appconfiguration_ruby_sdk/websocket/retry_policy.rb
Constant Summary collapse
- RETRY_CONFIG =
{ initial_delay: 15, max_delay: 3600, multiplier: 2, jitter_factor: 0.3 }.freeze
Class Method Summary collapse
Class Method Details
.next_delay(attempt) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ibm_appconfiguration_ruby_sdk/websocket/retry_policy.rb', line 26 def self.next_delay(attempt) base_delay = RETRY_CONFIG[:initial_delay] * (RETRY_CONFIG[:multiplier]**attempt) capped_delay = [ base_delay, RETRY_CONFIG[:max_delay] ].min jitter = capped_delay * RETRY_CONFIG[:jitter_factor] * rand capped_delay + jitter end |