Skip to content

Commit 336d9e1

Browse files
authored
Merge pull request #740 from stvoutsin/timeout-fix
FIX: Change tap to better handle timeout default based on context
2 parents c167399 + ce098da commit 336d9e1

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

CHANGES.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Enhancements and Fixes
55
----------------------
66

7+
- Improve handling of timeouts in tap wait and _update [#740]
8+
79
- Preserve text/plain error body in raise_if_error() after stream is consumed. [#736]
810

911
- Provide an API for SoftId-compliant management of the 'User-Agent'

pyvo/dal/tap.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,10 @@ def _update(self, wait_for_statechange=False, timeout=None):
718718
updates local job infos with remote values
719719
"""
720720
if timeout is None:
721-
timeout = DEFAULT_JOB_POLL_TIMEOUT
721+
timeout = (
722+
DEFAULT_JOB_WAIT_TIMEOUT if wait_for_statechange
723+
else DEFAULT_JOB_POLL_TIMEOUT
724+
)
722725
try:
723726
if wait_for_statechange:
724727
response = self._session.get(
@@ -983,8 +986,9 @@ def wait(self, *, phases=None, timeout=DEFAULT_JOB_WAIT_TIMEOUT):
983986
----------
984987
phases : list
985988
phases to wait for
986-
timeout : float
987-
maximum time to wait in seconds
989+
timeout : float or None
990+
maximum time to wait in seconds. If None, defaults to
991+
``DEFAULT_JOB_WAIT_TIMEOUT``.
988992
989993
Raises
990994
------

0 commit comments

Comments
 (0)