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

Unified Diff: client/utils/tools.py

Issue 2037253002: run_isolated.py: install CIPD packages (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: fix client fetching Created 4 years, 6 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 | « client/utils/subprocess42.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/utils/tools.py
diff --git a/client/utils/tools.py b/client/utils/tools.py
index ab9a492c921f6226168d4db2da99ef2fe715b8fe..823ae51e111fc06a6073f97ed03c7774fcf0827a 100644
--- a/client/utils/tools.py
+++ b/client/utils/tools.py
@@ -316,3 +316,14 @@ def get_cacerts_bundle():
# to current directory instead. We use our own bundled copy of cacert.pem.
_ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.')
return _ca_certs
+
+
+def sliding_timeout(timeout):
+ """Returns a function that returns how much time left till (now+timeout).
+
+ If timeout is None, the returned function always returns None.
+ """
+ if timeout is None:
+ return lambda: None
+ deadline = time.time() + timeout
+ return lambda: deadline - time.time()
« no previous file with comments | « client/utils/subprocess42.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698