Skip to content

Commit 65fbd7e

Browse files
committed
PYTHON-5505 Fix _retry_overload handling of backoff too
1 parent f3be7f7 commit 65fbd7e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pymongo/asynchronous/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ async def inner(*args: Any, **kwargs: Any) -> Any:
105105
raise
106106

107107
# Implement exponential backoff on retry.
108-
await _backoff(attempt)
108+
if exc.has_error_label("SystemOverloaded"):
109+
await _backoff(attempt)
109110
continue
110111

111112
return cast(F, inner)

pymongo/synchronous/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def inner(*args: Any, **kwargs: Any) -> Any:
105105
raise
106106

107107
# Implement exponential backoff on retry.
108-
_backoff(attempt)
108+
if exc.has_error_label("SystemOverloaded"):
109+
_backoff(attempt)
109110
continue
110111

111112
return cast(F, inner)

0 commit comments

Comments
 (0)