From 2bd600139d0aab5c403fc78d47ee841206eb4839 Mon Sep 17 00:00:00 2001 From: xaoyaoo Date: Fri, 22 Mar 2024 17:56:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=9E=E6=8E=A5?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=94=B9=E4=B8=BA=E5=85=B1=E7=94=A8=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=EF=BC=8C=E9=99=8D=E4=BD=8E=E6=97=B6=E9=97=B4=E5=BC=80?= =?UTF-8?q?=E9=94=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pywxdump/analyzer/utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pywxdump/analyzer/utils.py b/pywxdump/analyzer/utils.py index a9d40da..b5e6693 100644 --- a/pywxdump/analyzer/utils.py +++ b/pywxdump/analyzer/utils.py @@ -204,9 +204,10 @@ class DBPool: def __exit__(self, exc_type, exc_val, exc_tb): self.connection = None - def close(self): - self.connection.close() - self.connection = None + def close_all(self): + for db_path, connection in self.__db_pool.items(): + connection.close() + self.__db_pool.clear() def attach_databases(connection, databases):