This commit is contained in:
yumoqing 2026-04-13 16:31:31 +08:00
parent 12be28f5f7
commit 53c58f00fc

View File

@ -93,8 +93,13 @@ class SqlorPool:
yielded_sqlor = await self._new_sqlor() yielded_sqlor = await self._new_sqlor()
yielded_sqlor.used = True yielded_sqlor.used = True
yielded_sqlor.use_at = time.time() yielded_sqlor.use_at = time.time()
yield yielded_sqlor.sqlor try:
yielded_sqlor.used = False yield yielded_sqlor.sqlor
yielded_sqlor.used = False
return
except Exception as e:
yielded_sqlor.used = False
raise e
@SingletonDecorator @SingletonDecorator
@ -147,6 +152,7 @@ class DBPools:
await sqlor.rollback() await sqlor.rollback()
except: except:
pass pass
await sqlor.exit()
def get_exception(self): def get_exception(self):
return self.e_except return self.e_except