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:
1 parent
e61c66f662
commit
cdd255a736
1 file changed
+1
-2
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user