Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
f64ec8ab by Cédric Krier at 2022-12-23T19:44:09+01:00
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
- - - - -


1 changed file:

- trytond/trytond/worker.py


Changes:

=====================================
trytond/trytond/worker.py
=====================================
@@ -70,6 +70,8 @@
     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:



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/f64ec8ab3e76d68c7068ef3007f89e0d09618c71

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/f64ec8ab3e76d68c7068ef3007f89e0d09618c71
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to