Skip to content

Commit aa75fbc

Browse files
authored
Fix pool size limit check for unlimited pools (#888)
* Add test case for unlimited pool with minsize 0 * Skip pool limit check for unlimited pools
1 parent 7f40980 commit aa75fbc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

aiopg/pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ async def _fill_free_pool(self, override_min: bool) -> None:
352352
if self._free:
353353
return
354354

355-
if override_min and self.size < (self.maxsize or 0):
355+
if override_min and (not self.maxsize or self.size < self.maxsize):
356356
self._acquiring += 1
357357
try:
358358
conn = await connect(

tests/test_pool.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,13 @@ async def test_unlimited_size(create_pool):
441441
assert pool._free.maxlen is None
442442

443443

444+
async def test_unlimited_size_minsize_0_acquire(create_pool):
445+
pool = await create_pool(minsize=0, maxsize=0)
446+
async with pool.acquire() as conn:
447+
cur = await conn.cursor()
448+
await cur.execute("SELECT 1")
449+
450+
444451
async def test_connection_closed_after_timeout(create_pool):
445452
async def sleep(conn):
446453
cur = await conn.cursor()

0 commit comments

Comments
 (0)