Fix the issue that REST API returns unknown after postgres restart (#2956)

Close #2955
This commit is contained in:
Sophia Ruan
2023-11-30 10:02:19 +01:00
committed by GitHub
parent 5a77cbb087
commit 47cadc9f63
+2 -1
View File
@@ -147,7 +147,8 @@ class ConnectionPool:
def close(self) -> None:
"""Close all named connections from Patroni to PostgreSQL registered in the pool."""
with self._lock:
if any(conn.close(True) for conn in self._connections.values()):
closed_connections = [conn.close(True) for conn in self._connections.values()]
if any(closed_connections):
logger.info("closed patroni connections to postgres")