diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2017-09-26 14:27:49 +0100 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2017-09-26 14:31:50 +0100 |
commit | cd3ae9722cf9174a566bb2bbe1447a2b2402709b (patch) | |
tree | 1306049482661f8c7a4b7e74d2f24ecc6c13c94b | |
parent | 9deeb964eadc1d6bf2e18244fb6b5347c5d6a1f0 (diff) | |
download | ybd-benbrown/lockfiles.tar.gz |
Continue if the lockfile no longer existsbenbrown/lockfiles
-rw-r--r-- | ybd/app.py | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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']: |