diff options
-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']: |