From 99c80275e57e8b34e5f11eb4ffdd18250f0752dc Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 22 Oct 2019 15:50:49 +0800 Subject: [PATCH] bugfix --- sqlor/dbpools.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sqlor/dbpools.py b/sqlor/dbpools.py index aa02969..0c43ee1 100644 --- a/sqlor/dbpools.py +++ b/sqlor/dbpools.py @@ -115,10 +115,11 @@ class ConnectionPool(object): self.connectObject = {} self.use_cnt = 0 self.max_use = 1000 - self.lock = asyncio.Lock() + # self.lock = asyncio.Lock() # self.lockstatus() def lockstatus(self): + return self.loop.call_later(5,self.lockstatus) print('--lock statu=',self.lock.locked(), '--pool empty()=',self._pool.empty(), @@ -145,15 +146,22 @@ class ConnectionPool(object): async def aquire(self): lc = await self._pool.get() conn = await lc.use() + """ with await self.lock: self.connectObject[lc.conn] = lc + """ + self.connectObject[lc.conn] = lc return conn async def release(self,conn): lc = None + """ with await self.lock: lc = self.connectObject.get(conn,None) del self.connectObject[conn] + """ + lc = self.connectObject.get(conn,None) + del self.connectObject[conn] await self._pool.put(lc) @SingletonDecorator