Module: Mongo::Retryable::Backpressure Private
Do not use. This module is for internal use only.
| Relationships & Source Files | |
| Defined in: | lib/mongo/retryable/backpressure.rb |
Overview
Constants and helpers for client backpressure (exponential backoff and jitter in retry loops).
Constant Summary
-
BASE_BACKOFF =
# File 'lib/mongo/retryable/backpressure.rb', line 11
Base backoff delay in seconds.
0.1 -
DEFAULT_MAX_RETRIES =
# File 'lib/mongo/retryable/backpressure.rb', line 17
Default maximum number of retries for overload errors.
2 -
MAX_BACKOFF =
# File 'lib/mongo/retryable/backpressure.rb', line 14
Maximum backoff delay in seconds.
10
Class Method Summary
-
.backoff_delay(attempt, jitter: rand) ⇒ Float
Internal use only
Calculate the backoff delay for a given retry attempt.
Class Method Details
.backoff_delay(attempt, jitter: rand) ⇒ Float
Calculate the backoff delay for a given retry attempt.
# File 'lib/mongo/retryable/backpressure.rb', line 26
def self.backoff_delay(attempt, jitter: rand) jitter * [ MAX_BACKOFF, BASE_BACKOFF * (2**(attempt - 1)) ].min end