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_RETRY_TOKEN_CAPACITY =
# File 'lib/mongo/retryable/backpressure.rb', line 23
Default capacity of the retry token bucket.
1000 -
MAX_BACKOFF =
# File 'lib/mongo/retryable/backpressure.rb', line 14
Maximum backoff delay in seconds.
10 -
MAX_RETRIES =
# File 'lib/mongo/retryable/backpressure.rb', line 17
Maximum number of retries for overload errors.
5 -
RETRY_TOKEN_RETURN_RATE =
# File 'lib/mongo/retryable/backpressure.rb', line 20
Rate at which tokens are returned to the bucket on success.
0.1
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 32
def self.backoff_delay(attempt, jitter: rand) jitter * [ MAX_BACKOFF, BASE_BACKOFF * (2**(attempt - 1)) ].min end