Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Unified Diff: build/android/pylib/device/decorators.py

Issue 666803003: [Android] Make WithTimeoutAndRetry-decorated functions self-aware. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | build/android/pylib/utils/timeout_retry.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/device/decorators.py
diff --git a/build/android/pylib/device/decorators.py b/build/android/pylib/device/decorators.py
index 9362f95528d10318d43cf5d7dbf0e414169a05de..074a0fcac14131abe15fc3cdbf719c15849f7908 100644
--- a/build/android/pylib/device/decorators.py
+++ b/build/android/pylib/device/decorators.py
@@ -9,6 +9,7 @@ Function/method decorators that provide timeout and retry logic.
import functools
import os
import sys
+import threading
from pylib import constants
from pylib.device import device_errors
@@ -48,7 +49,11 @@ def _TimeoutRetryWrapper(f, timeout_func, retries_func, pass_values=False):
def impl():
return f(*args, **kwargs)
try:
- return timeout_retry.Run(impl, timeout, retries)
+ if isinstance(threading.current_thread(),
+ timeout_retry.TimeoutRetryThread):
+ return impl()
+ else:
+ return timeout_retry.Run(impl, timeout, retries)
except old_errors.WaitForResponseTimedOutError as e:
raise device_errors.CommandTimeoutError(str(e)), None, (
sys.exc_info()[2])
« no previous file with comments | « no previous file | build/android/pylib/utils/timeout_retry.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698