From 53c58f00fc011ec34c895fdc2ad4bac0f5275aa0 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 13 Apr 2026 16:31:31 +0800 Subject: [PATCH] bugfix --- sqlor/dbpools.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sqlor/dbpools.py b/sqlor/dbpools.py index 85f7f84..c91cf82 100755 --- a/sqlor/dbpools.py +++ b/sqlor/dbpools.py @@ -93,8 +93,13 @@ class SqlorPool: yielded_sqlor = await self._new_sqlor() yielded_sqlor.used = True yielded_sqlor.use_at = time.time() - yield yielded_sqlor.sqlor - yielded_sqlor.used = False + try: + yield yielded_sqlor.sqlor + yielded_sqlor.used = False + return + except Exception as e: + yielded_sqlor.used = False + raise e @SingletonDecorator @@ -147,6 +152,7 @@ class DBPools: await sqlor.rollback() except: pass + await sqlor.exit() def get_exception(self): return self.e_except