| Index: devil/devil/utils/timeout_retry.py
|
| diff --git a/devil/devil/utils/timeout_retry.py b/devil/devil/utils/timeout_retry.py
|
| index d2304629e9c00a66b114191e2bc5cbb34f52b94a..2327b6bf0ca46c93bbe7a185121eb09e39699dae 100644
|
| --- a/devil/devil/utils/timeout_retry.py
|
| +++ b/devil/devil/utils/timeout_retry.py
|
| @@ -28,7 +28,7 @@ class TimeoutRetryThreadGroup(reraiser_thread.ReraiserThreadGroup):
|
| def GetElapsedTime(self):
|
| return self._watcher.GetElapsed()
|
|
|
| - def GetRemainingTime(self, required=0, msg=None):
|
| + def GetRemainingTime(self, required=0, suffix=None):
|
| """Get the remaining time before the thread times out.
|
|
|
| Useful to send as the |timeout| parameter of async IO operations.
|
| @@ -48,11 +48,9 @@ class TimeoutRetryThreadGroup(reraiser_thread.ReraiserThreadGroup):
|
| """
|
| remaining = self._watcher.GetRemaining()
|
| if remaining is not None and remaining < required:
|
| - if msg is None:
|
| - msg = 'Timeout expired'
|
| - if remaining > 0:
|
| - msg += (', wait of %.1f secs required but only %.1f secs left'
|
| - % (required, remaining))
|
| + msg = 'Timeout of %.1f secs expired' % self._watcher.GetTimeout()
|
| + if suffix:
|
| + msg += suffix
|
| raise reraiser_thread.TimeoutError(msg)
|
| return remaining
|
|
|
| @@ -110,7 +108,7 @@ def WaitFor(condition, wait_period=5, max_tries=None):
|
| if timeout_thread_group:
|
| # pylint: disable=no-member
|
| timeout_thread_group.GetRemainingTime(wait_period,
|
| - msg='Timed out waiting for %r' % condition_name)
|
| + suffix=' waiting for condition %r' % condition_name)
|
| time.sleep(wait_period)
|
| return None
|
|
|
|
|