mirror of
https://github.com/ansible/awx.git
synced 2026-05-22 00:07:40 -02:30
cheesy global lock
This commit is contained in:
@@ -241,8 +241,9 @@ def process_graph(graph, task_capacity):
|
||||
(str(node_obj), str(impact), str(remaining_volume)))
|
||||
|
||||
def schedule():
|
||||
lockfile = open("/tmp/tower_scheduler.lock", "w")
|
||||
fcntl.lockf(lockfile, fcntl.LOCK_EX)
|
||||
with transaction.atomic():
|
||||
# Lock
|
||||
Instance.objects.select_for_update().all()[0]
|
||||
|
||||
task_capacity = get_system_task_capacity()
|
||||
|
||||
@@ -254,5 +255,4 @@ def schedule():
|
||||
if graph:
|
||||
process_graph(graph, task_capacity)
|
||||
|
||||
fcntl.lockf(lockfile, fcntl.LOCK_UN)
|
||||
|
||||
# Unlock, due to transaction ending
|
||||
|
||||
Reference in New Issue
Block a user