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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user