提交 884c6d04 authored 作者: Frederic Bastien's avatar Frederic Bastien

be more robust when we refresh the lock

上级 f0efd2a7
...@@ -101,7 +101,14 @@ def get_lock(lock_dir=None, **kw): ...@@ -101,7 +101,14 @@ def get_lock(lock_dir=None, **kw):
if now - get_lock.start_time > config.compile.timeout/2: if now - get_lock.start_time > config.compile.timeout/2:
lockpath = os.path.join(get_lock.lock_dir, 'lock') lockpath = os.path.join(get_lock.lock_dir, 'lock')
_logger.info('Refreshing lock %s', str(lockpath)) _logger.info('Refreshing lock %s', str(lockpath))
refresh_lock(lockpath) try:
refresh_lock(lockpath)
except Exception:
while get_lock.lock_is_enabled:
release_lock()
_logger.info('Refreshing lock failed, we release the'
' lock before raising again the exception')
raise
get_lock.start_time = now get_lock.start_time = now
get_lock.n_lock += 1 get_lock.n_lock += 1
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论