Chromium Code Reviews| Index: client/utils/tools.py |
| diff --git a/client/utils/tools.py b/client/utils/tools.py |
| index ab9a492c921f6226168d4db2da99ef2fe715b8fe..08476f5f9294dcd96eafdcf324e58385cc7ea366 100644 |
| --- a/client/utils/tools.py |
| +++ b/client/utils/tools.py |
| @@ -316,3 +316,13 @@ 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 |
| + |
| + |
| +class Timeouter(object): |
|
Vadim Sh.
2016/06/06 21:32:14
not sure it's worth the dedicated class... I don't
M-A Ruel
2016/06/06 23:34:51
I agree.
nodir
2016/06/07 18:46:35
changed to a function that returns a closure
|
| + """Computes time left till deadline.""" |
| + |
| + def __init__(self, timeout): |
| + self.deadline = time.time() + timeout if timeout is not None else None |
| + |
| + def left(self): |
| + return self.deadline - time.time() if self.deadline is not None else None |