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


Commits:
64fc05d1 by Cédric Krier at 2022-12-23T23:57:17+01:00
Avoid concurrency failure in cache test with channel

We need to ensure that the listener has finished to clear the cache before
resume the main thread execution.

Closes #11950
- - - - -


1 changed file:

- trytond/trytond/cache.py


Changes:

=====================================
trytond/trytond/cache.py
=====================================
@@ -369,8 +369,6 @@
 
             cursor = conn.cursor()
             cursor.execute('LISTEN "%s"' % cls._channel)
-            current_thread.listening = True
-
             # Clear everything in case we missed a payload
             Pool(dbname).refresh(_get_modules(cursor))
             cls._clear_all(dbname)
@@ -374,6 +372,7 @@
             # Clear everything in case we missed a payload
             Pool(dbname).refresh(_get_modules(cursor))
             cls._clear_all(dbname)
+            current_thread.listening = True
 
             selector.register(conn, selectors.EVENT_READ)
             while cls._listener.get((pid, dbname)) == current_thread:



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

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


Reply via email to