Skip to content
Snippets Groups Projects
Commit 8785cb30 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

ganeti-noded: Add constant for queue lock timeout

Reviewed-by: iustinp
parent 1bc59f76
No related branches found
No related tags found
No related merge requests found
...@@ -52,14 +52,17 @@ def _RequireJobQueueLock(fn): ...@@ -52,14 +52,17 @@ def _RequireJobQueueLock(fn):
"""Decorator for job queue manipulating functions. """Decorator for job queue manipulating functions.
""" """
QUEUE_LOCK_TIMEOUT = 10
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
# Locking in exclusive, blocking mode because there could be several # Locking in exclusive, blocking mode because there could be several
# children running at the same time. Waiting up to 10 seconds. # children running at the same time. Waiting up to 10 seconds.
queue_lock.Exclusive(blocking=True, timeout=10) queue_lock.Exclusive(blocking=True, timeout=QUEUE_LOCK_TIMEOUT)
try: try:
return fn(*args, **kwargs) return fn(*args, **kwargs)
finally: finally:
queue_lock.Unlock() queue_lock.Unlock()
return wrapper return wrapper
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment