Add some randomness to avoid concurrent pulling of new tasks

This prevents multiple workers to pull the same new task at the same time which
can create concurrency conflict.

Closes #11938
This commit is contained in:
Cédric Krier
2022-12-23 19:44:09 +01:00
parent 0ae1b367eb
commit 2da4311287
+2
View File
@@ -70,6 +70,8 @@ def work(options):
try:
while True:
timeout = options.timeout
# Add some randomness to avoid concurrent pulling
time.sleep(0.1 * random.random())
while len(tasks.filter()) >= processes:
time.sleep(0.1)
for queue in queues: