Bug 1287496 - Increment sleep timespan by (attempts * delay) seconds. r=ted
authorRob Thijssen <rthijssen@mozilla.com>
Mon, 18 Jul 2016 18:12:01 +0100
changeset 345912 563d7aa9dab4898e2cb9cdec77573f9dce946af5
parent 345911 8f018f9e7725f4566f24dc6e5a8d8fa627a01a1c
child 345913 5f4846ed9f65d7622fdbd8993289daeb6b29b692
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1287496
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287496 - Increment sleep timespan by (attempts * delay) seconds. r=ted MozReview-Commit-ID: Gx9fxp3xfZA
testing/mozbase/mozfile/mozfile/mozfile.py
--- a/testing/mozbase/mozfile/mozfile/mozfile.py
+++ b/testing/mozbase/mozfile/mozfile/mozfile.py
@@ -137,16 +137,18 @@ def rmtree(dir):
     return remove(dir)
 
 
 def _call_windows_retry(func, args=(), retry_max=5, retry_delay=0.5):
     """
     It's possible to see spurious errors on Windows due to various things
     keeping a handle to the directory open (explorer, virus scanners, etc)
     So we try a few times if it fails with a known error.
+    retry_delay is multiplied by the number of failed attempts to increase
+    the likelihood of success in subsequent attempts.
     """
     retry_count = 0
     while True:
         try:
             func(*args)
         except OSError as e:
             # Error codes are defined in:
             # http://docs.python.org/2/library/errno.html#module-errno
@@ -155,34 +157,34 @@ def _call_windows_retry(func, args=(), r
 
             if retry_count == retry_max:
                 raise
 
             retry_count += 1
 
             print '%s() failed for "%s". Reason: %s (%s). Retrying...' % \
                     (func.__name__, args, e.strerror, e.errno)
-            time.sleep(retry_delay)
+            time.sleep(retry_count * retry_delay)
         else:
             # If no exception has been thrown it should be done
             break
 
 
 def remove(path):
     """Removes the specified file, link, or directory tree.
 
     This is a replacement for shutil.rmtree that works better under
     windows. It does the following things:
 
      - check path access for the current user before trying to remove
      - retry operations on some known errors due to various things keeping
        a handle on file paths - like explorer, virus scanners, etc. The
        known errors are errno.EACCES and errno.ENOTEMPTY, and it will
-       retry up to 5 five times with a delay of 0.5 seconds between each
-       attempt.
+       retry up to 5 five times with a delay of (failed_attempts * 0.5) seconds
+       between each attempt.
 
     Note that no error will be raised if the given path does not exists.
 
     :param path: path to be removed
     """
 
     import shutil