summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Brown <ben.brown@codethink.co.uk>2017-09-26 14:27:49 +0100
committerBen Brown <ben.brown@codethink.co.uk>2017-09-26 14:31:50 +0100
commitcd3ae9722cf9174a566bb2bbe1447a2b2402709b (patch)
tree1306049482661f8c7a4b7e74d2f24ecc6c13c94b
parent9deeb964eadc1d6bf2e18244fb6b5347c5d6a1f0 (diff)
downloadybd-benbrown/lockfiles.tar.gz
Continue if the lockfile no longer existsbenbrown/lockfiles
-rw-r--r--ybd/app.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/ybd/app.py b/ybd/app.py
index 36fbebc..1040ab3 100644
--- a/ybd/app.py
+++ b/ybd/app.py
@@ -41,10 +41,14 @@ class RetryException(Exception):
if config.get('last-retry-time'):
wait = datetime.datetime.now() - config.get('last-retry-time')
if wait.seconds < 1 and os.path.exists(lockfile(dn)):
- with open(lockfile(dn), 'r') as L:
- call(['flock', '--shared', '--timeout',
- config.get('timeout', '60'), str(L.fileno())])
- log(dn, 'Finished wait loop', verbose=True)
+ try:
+ with open(lockfile(dn), 'r') as L:
+ call(['flock', '--shared', '--timeout',
+ config.get('timeout', '60'), str(L.fileno())])
+ log(dn, 'Finished wait loop', verbose=True)
+ except IOError:
+ # The process that had the lock is finished with it.
+ pass
config['last-retry-time'] = datetime.datetime.now()
config['last-retry-dn'] = dn
for dirname in config['sandboxes']: