Skip to content

Commit 5b9a2e8

Browse files
committed
address offline feedback
1 parent b7ea26e commit 5b9a2e8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

google/api_core/timeout.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,10 @@ def func_with_timeout(*args, **kwargs):
119119
# is deprecated, and should be treated the same as the `timeout`,
120120
# it is still possible for `deadline` argument in google.api_core.retry.Retry
121121
# to be larger than the `timeout`.
122-
# Avoid setting negative timeout or timeout less than 5 seconds when the `timeout`
123-
# has expired.
124122
# See https://github.com/googleapis/python-api-core/issues/654
125-
# Revert back to the original timeout when this happens
126-
if remaining_timeout < 5:
123+
# Only positive non-zero timeouts are supported.
124+
# Revert back to the initial timeout for negative or 0 timeout values.
125+
if remaining_timeout < 1:
127126
remaining_timeout = self._timeout
128127

129128
kwargs["timeout"] = remaining_timeout

tests/unit/test_timeout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def _clock():
8282
wrapped()
8383
target.assert_called_with(timeout=41.0)
8484
wrapped()
85-
target.assert_called_with(timeout=42.0)
85+
target.assert_called_with(timeout=3.0)
8686
wrapped()
8787
target.assert_called_with(timeout=42.0)
8888
wrapped()

0 commit comments

Comments
 (0)