This commit is contained in:
yumoqing 2025-10-19 11:47:08 +08:00
parent 91e717d80f
commit 3426bda470

View File

@ -64,7 +64,7 @@ class SqlorPool:
if not s.used: if not s.used:
yielded_sqlor = s yielded_sqlor = s
if not yielded_sqlor: if not yielded_sqlor:
yielded_sqlor = 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 yield yielded_sqlor.sqlor
@ -104,6 +104,7 @@ class DBPools:
pool = SqlorPool(f) pool = SqlorPool(f)
self._pools[name] = pool self._pools[name] = pool
self.e_except = None self.e_except = None
sqlor = None
try: try:
async with pool.context() as sqlor: async with pool.context() as sqlor:
yield sqlor yield sqlor