Skip to content

Commit

Permalink
pool: async with self._cond instead of with (await pool._cond), c…
Browse files Browse the repository at this point in the history
…loses aio-libs#508
  • Loading branch information
Gustavo Carneiro committed Nov 20, 2018
1 parent 8868bac commit 69c7dda
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions aiopg/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async def _create_pool(dsn=None, *, minsize=1, maxsize=10,
enable_uuid=enable_uuid, echo=echo, on_connect=on_connect,
pool_recycle=pool_recycle, **kwargs)
if minsize > 0:
with (await pool._cond):
async with pool._cond:
await pool._fill_free_pool(False)
return pool

Expand Down Expand Up @@ -102,7 +102,7 @@ def timeout(self):

async def clear(self):
"""Close all free connections in pool."""
with (await self._cond):
async with self._cond:
while self._free:
conn = self._free.popleft()
await conn.close()
Expand Down Expand Up @@ -149,7 +149,7 @@ async def wait_closed(self):
conn = self._free.popleft()
conn.close()

with (await self._cond):
async with self._cond:
while self.size > self.freesize:
await self._cond.wait()

Expand All @@ -163,7 +163,7 @@ def acquire(self):
async def _acquire(self):
if self._closing:
raise RuntimeError("Cannot acquire connection after closing pool")
with (await self._cond):
async with self._cond:
while True:
await self._fill_free_pool(True)
if self._free:
Expand Down Expand Up @@ -226,7 +226,7 @@ async def _fill_free_pool(self, override_min):
self._acquiring -= 1

async def _wakeup(self):
with (await self._cond):
async with self._cond:
self._cond.notify()

def release(self, conn):
Expand Down

0 comments on commit 69c7dda

Please sign in to comment.