Set default --lock_timeout to 5m
gclient-sync + git-cache are racy because if two different DEPS files
dependent on the same repo URL, even if depsed to different checkout
dirs, they use same git cache dir. If both checkout dirs are synced at
the same time, one of them cannot acquire a lock.
This is a cheap solution to change --lock_timeout option default value
from 0 to 5m.
R=hinoka@chromium.org
BUG=593468
Review URL: https://codereview.chromium.org/1785083005
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299386 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_cache.py b/git_cache.py
index 9137ef5..753ccde 100755
--- a/git_cache.py
+++ b/git_cache.py
@@ -93,7 +93,6 @@
"""Acquire the lock.
This will block with a deadline of self.timeout seconds.
- If self.timeout is zero, this is a NON-BLOCKING FAIL-FAST operation.
"""
elapsed = 0
while True:
@@ -102,7 +101,7 @@
return
except OSError as e:
if elapsed < self.timeout:
- sleep_time = min(3, self.timeout - elapsed)
+ sleep_time = max(10, min(3, self.timeout - elapsed))
logging.info('Could not create git cache lockfile; '
'will retry after sleep(%d).', sleep_time);
elapsed += sleep_time