提交 8afdfa27 authored 作者: Frederic's avatar Frederic

Break the infinit loop when taking the lock and that the compiledir is full.

上级 2e98ca4e
...@@ -157,6 +157,7 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -157,6 +157,7 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
no_display = (verbosity == 0) no_display = (verbosity == 0)
# Acquire lock. # Acquire lock.
nb_error = 0
while True: while True:
try: try:
last_owner = 'no_owner' last_owner = 'no_owner'
...@@ -221,7 +222,11 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -221,7 +222,11 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
except OSError: except OSError:
# Error while creating the directory: someone else must have tried # Error while creating the directory: someone else must have tried
# at the exact same time. # at the exact same time.
nb_error += 1
if nb_error < 10:
continue continue
else:
raise
# Safety check: the directory should be here. # Safety check: the directory should be here.
assert os.path.isdir(tmp_dir) assert os.path.isdir(tmp_dir)
...@@ -241,6 +246,9 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -241,6 +246,9 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
except Exception, e: except Exception, e:
# If something wrong happened, we try again. # If something wrong happened, we try again.
_logger.warning("Something wrong happened: %s %s", type(e), e) _logger.warning("Something wrong happened: %s %s", type(e), e)
nb_error += 1
if nb_error > 10:
raise
time.sleep(random.uniform(min_wait, max_wait)) time.sleep(random.uniform(min_wait, max_wait))
continue continue
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论