Module: Mongo::Retryable::Backpressure Private
- Defined in:
- lib/mongo/retryable/backpressure.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Constants and helpers for client backpressure (exponential backoff and jitter in retry loops).
Constant Summary collapse
- BASE_BACKOFF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Base backoff delay in seconds.
0.1- MAX_BACKOFF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Maximum backoff delay in seconds.
10- DEFAULT_MAX_RETRIES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Default maximum number of retries for overload errors.
2
Class Method Summary collapse
-
.backoff_delay(attempt, jitter: rand) ⇒ Float
private
Calculate the backoff delay for a given retry attempt.
Class Method Details
.backoff_delay(attempt, jitter: rand) ⇒ Float
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Calculate the backoff delay for a given retry attempt.
26 27 28 |
# 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 |