Revision 8785cb30 daemons/ganeti-noded
b/daemons/ganeti-noded | ||
---|---|---|
52 | 52 |
"""Decorator for job queue manipulating functions. |
53 | 53 |
|
54 | 54 |
""" |
55 |
QUEUE_LOCK_TIMEOUT = 10 |
|
56 |
|
|
55 | 57 |
def wrapper(*args, **kwargs): |
56 | 58 |
# Locking in exclusive, blocking mode because there could be several |
57 | 59 |
# children running at the same time. Waiting up to 10 seconds. |
58 |
queue_lock.Exclusive(blocking=True, timeout=10)
|
|
60 |
queue_lock.Exclusive(blocking=True, timeout=QUEUE_LOCK_TIMEOUT)
|
|
59 | 61 |
try: |
60 | 62 |
return fn(*args, **kwargs) |
61 | 63 |
finally: |
62 | 64 |
queue_lock.Unlock() |
65 |
|
|
63 | 66 |
return wrapper |
64 | 67 |
|
65 | 68 |
|
Also available in: Unified diff