Skip to content

Commit 994ca7a

Browse files
author
Jon Wayne Parrott
committed
Address review comments
1 parent 5489470 commit 994ca7a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

core/google/api/core/retry.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from google.api.core.helpers import datetime_helpers
2626

2727
_LOGGER = logging.getLogger(__name__)
28-
_DEFAULT_JITTER_AMOUNT = 0.2
28+
_DEFAULT_MAX_JITTER = 0.2
2929

3030

3131
def if_exception_type(*exception_types):
@@ -50,12 +50,21 @@ def inner(exception):
5050
if_transient_error = if_exception_type((
5151
exceptions.InternalServerError,
5252
exceptions.TooManyRequests))
53-
"""A predicate that checks if an exception is a transient API error."""
53+
"""A predicate that checks if an exception is a transient API error.
54+
55+
The following server errors are considered transient:
56+
57+
- :class:`google.api.core.exceptions.InternalServerError` - HTTP 500, gRPC
58+
``INTERNAL(13)`` and its subclasses.
59+
- :class:`google.api.core.exceptions.TooManyRequests` - HTTP 429
60+
- :class:`google.api.core.exceptions.ResourceExhausted` - gRPC
61+
``RESOURCE_EXHAUSTED(8)``
62+
"""
5463
# pylint: enable=invalid-name
5564

5665

5766
def exponential_sleep_generator(
58-
initial, maximum, multiplier=2, jitter=_DEFAULT_JITTER_AMOUNT):
67+
initial, maximum, multiplier=2, jitter=_DEFAULT_MAX_JITTER):
5968
"""Generates sleep intervals based on the exponential back-off algorithm.
6069
6170
This implements the `Truncated Exponential Back-off`_ algorithm.

0 commit comments

Comments
 (0)