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