Skip to content

Commit 8f30f3e

Browse files
committed
fix(retry): ignore non-finite Retry-After values
Signed-off-by: Somay-kousis <somaykaush@gmail.com>
1 parent 089e390 commit 8f30f3e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎packages/nvidia_nat_core/src/nat/utils/exception_handlers/automatic_retries.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import gc
2828
import inspect
2929
import logging
30+
import math
3031
import re
3132
import threading
3233
import time
@@ -261,7 +262,7 @@ def _retry_after_seconds(exc: BaseException) -> float | None:
261262
if value is not None:
262263
try:
263264
wait_ms = float(value)
264-
if wait_ms >= 0:
265+
if math.isfinite(wait_ms) and wait_ms >= 0:
265266
return wait_ms / 1000
266267
except ValueError:
267268
pass
@@ -271,7 +272,7 @@ def _retry_after_seconds(exc: BaseException) -> float | None:
271272
return None
272273
try:
273274
wait = float(value)
274-
return wait if wait >= 0 else None
275+
return wait if math.isfinite(wait) and wait >= 0 else None
275276
except ValueError:
276277
pass
277278
try:

0 commit comments

Comments
 (0)