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
This commit is contained in:
Cédric Krier committed 2022-12-23 23:57:17 +01:00
1 parent e61c66f662
commit cdd255a736
1 file changed
+1 -2
+1 -2
View File
@@ -369,11 +369,10 @@ class MemoryCache(BaseCache):
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)
current_thread.listening = True
selector.register(conn, selectors.EVENT_READ)
while cls._listener.get((pid, dbname)) == current_thread: