From f0ca8e58a4125fa83c5ec1d02d46845c37e9a8c5 Mon Sep 17 00:00:00 2001 From: Harjoth Khara Date: Tue, 2 Jun 2026 17:24:21 -0700 Subject: [PATCH] fix: correct jitter comment to reflect 25% scaling --- src/openai/_base_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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