Class: GetStreamRuby::RetryConfig
- Inherits:
-
Object
- Object
- GetStreamRuby::RetryConfig
- Defined in:
- lib/getstream_ruby/retry_config.rb
Overview
Opt-in auto-retry policy. Disabled by default: the client performs exactly one attempt and surfaces errors unchanged. When enabled, only GET/HEAD requests failing with HTTP 429 or a transport error are retried.
Instance Attribute Summary collapse
-
#max_attempts ⇒ Object
readonly
Returns the value of attribute max_attempts.
-
#max_backoff ⇒ Object
readonly
Returns the value of attribute max_backoff.
Instance Method Summary collapse
- #enabled? ⇒ Boolean
-
#initialize(enabled: false, max_attempts: 3, max_backoff: 30.0) ⇒ RetryConfig
constructor
A new instance of RetryConfig.
Constructor Details
#initialize(enabled: false, max_attempts: 3, max_backoff: 30.0) ⇒ RetryConfig
Returns a new instance of RetryConfig.
12 13 14 15 16 17 18 19 |
# File 'lib/getstream_ruby/retry_config.rb', line 12 def initialize(enabled: false, max_attempts: 3, max_backoff: 30.0) raise ArgumentError, 'max_attempts must be >= 1' if max_attempts < 1 raise ArgumentError, 'max_backoff must be >= 0' if max_backoff.negative? @enabled = enabled @max_attempts = max_attempts @max_backoff = max_backoff.to_f end |
Instance Attribute Details
#max_attempts ⇒ Object (readonly)
Returns the value of attribute max_attempts.
10 11 12 |
# File 'lib/getstream_ruby/retry_config.rb', line 10 def max_attempts @max_attempts end |
#max_backoff ⇒ Object (readonly)
Returns the value of attribute max_backoff.
10 11 12 |
# File 'lib/getstream_ruby/retry_config.rb', line 10 def max_backoff @max_backoff end |
Instance Method Details
#enabled? ⇒ Boolean
21 22 23 |
# File 'lib/getstream_ruby/retry_config.rb', line 21 def enabled? @enabled end |