Reset the pool instances only on the pool initialization

In a scenario where cache_timeout is set to zero, concurrent updates to the
pool might result in an empty pool dictionary because the process making the
update lose its reference to the updated pool thus replacing it with an empty
dictionary on the following instantiation of Pool.

Closes #13763
This commit is contained in:
Nicolas Évrard
2024-12-17 15:14:04 +01:00
parent 7a9820e5af
commit ac6e93b078
+1 -1
View File
@@ -117,7 +117,6 @@ class Pool(object):
'''
with cls._lock:
cls._pools.pop(database_name, None)
cls._pool_instances.clear()
@classmethod
def database_list(cls):
@@ -147,6 +146,7 @@ class Pool(object):
self._pools[self.database_name] = self._pool
self._pool_modules[self.database_name] = self._modules
self._pool_instances.clear()
self._pool_instances.add(self)
if restart:
self.init()