Skip to content

Commit 10e4f51

Browse files
committed
Add error predicate to 'retry_403'.
Exclude Forbidden exceptions which do not have 'rateLimitExceed' as the reason for one of their errors. Addresses: #2089 (comment).
1 parent 7dfa1ad commit 10e4f51

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

system_tests/bigquery.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,17 @@
2929

3030
DATASET_NAME = 'system_tests' + unique_resource_id()
3131

32+
33+
def _rate_limit_exceeded(forbidden):
34+
"""Predicate: pass only exceptions with 'rateLimitExceeded' as reason."""
35+
return any(error['reason'] == 'rateLimitExceeded'
36+
for error in forbidden._errors)
37+
3238
# We need to wait to stay within the rate limits.
3339
# The alternative outcome is a 403 Forbidden response from upstream, which
3440
# they return instead of the more appropriate 429.
3541
# See: https://cloud.google.com/bigquery/quota-policy
36-
retry_403 = RetryErrors(Forbidden)
42+
retry_403 = RetryErrors(Forbidden, error_predicate=_rate_limit_exceeded)
3743

3844

3945
class Config(object):

0 commit comments

Comments
 (0)