From 35f008c9e762efabf4c2ad9d63586df61435d8be Mon Sep 17 00:00:00 2001 From: Mathieu Germain Date: Fri, 22 Apr 2016 01:13:37 -0400 Subject: [PATCH] Update filelock.py --- smartdispatch/filelock.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/smartdispatch/filelock.py b/smartdispatch/filelock.py index b86c7e6..accd192 100644 --- a/smartdispatch/filelock.py +++ b/smartdispatch/filelock.py @@ -47,6 +47,9 @@ def open_with_flock(*args, **kwargs): except IOError as e: if e.errno == errno.EDEADLK: logging.warn("The OS complained because the process have been waiting on the lockf for {0} sec with the error ({1}: {2}). Retrying. ".format(time.time() - start_time, e.errno, e.strerror)) + f.close() + time.sleep(TIME_BETWEEN_ATTEMPTS) + f = open(*args, **kwargs) no_attempt += 1 else: raise e