diff options
author | Erik M. Bray <erik.bray@lri.fr> | 2016-09-27 14:55:02 +0200 |
---|---|---|
committer | Erik M. Bray <erik.bray@lri.fr> | 2016-09-27 17:48:18 +0200 |
commit | 401cb36b4c1ee00bd02ea0c70509bab70e34ad02 (patch) | |
tree | 78b09b384fd681857fbd99d32c4fcc0cef418cab | |
parent | ed3f43d3d1eadc897c24f1ac6589d4b63da62189 (diff) | |
download | psutil-401cb36b4c1ee00bd02ea0c70509bab70e34ad02.tar.gz |
Double sleep time between attempts
-rw-r--r-- | psutil/tests/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index a90e785c..60d540d5 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -378,6 +378,7 @@ def wait_for_pid(pid, timeout=GLOBAL_TIMEOUT): def wait_for_file(fname, timeout=GLOBAL_TIMEOUT, delete_file=True): """Wait for a file to be written on disk with some content.""" stop_at = time.time() + timeout + sleep_for = 0.001 while time.time() < stop_at: try: with open(fname, "r") as f: @@ -388,7 +389,8 @@ def wait_for_file(fname, timeout=GLOBAL_TIMEOUT, delete_file=True): os.remove(fname) return data except (IOError, OSError): - time.sleep(0.001) + time.sleep(sleep_for) + sleep_for *= 2 raise RuntimeError( "timed out after %s secs (couldn't read file)" % timeout) |