diff --git a/src/openai/_base_client.py b/src/openai/_base_client.py index 216b36aabd..6d60fed9d2 100644 --- a/src/openai/_base_client.py +++ b/src/openai/_base_client.py @@ -787,7 +787,7 @@ def _calculate_retry_timeout( # Apply exponential backoff, but not more than the max. sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY) - # Apply some jitter, plus-or-minus half a second. + # Apply jitter, scaling the delay down by up to 25%. jitter = 1 - 0.25 * random() timeout = sleep_seconds * jitter return timeout if timeout >= 0 else 0