Skip to content

Commit

Permalink
add Pool.closed property as present in aiopg, fixes #463
Browse files Browse the repository at this point in the history
  • Loading branch information
Nothing4You committed Jan 31, 2022
1 parent c0972d2 commit 7b08db8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ To be included in 1.0.0 (unreleased)
* Support PyMySQL up to version 1.0.2 #643
* Bump minimal PyMySQL version to 1.0.0 #713
* Align % formatting in Cursor.executemany() with Cursor.execute(), literal % now need to be doubled in Cursor.executemany() #714
* Add Pool.closed property as present in aiopg #463


0.0.22 (2021-11-14)
Expand Down
6 changes: 5 additions & 1 deletion aiomysql/pool.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# copied from aiopg
# based on aiopg pool
# https://github.com/aio-libs/aiopg/blob/master/aiopg/pool.py

import asyncio
Expand Down Expand Up @@ -79,6 +79,10 @@ async def clear(self):
await conn.ensure_closed()
self._cond.notify()

@property
def closed(self):
return self._closed

def close(self):
"""Close pool.
Expand Down
1 change: 1 addition & 0 deletions tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ async def wait_closed():
await asyncio.gather(wait_closed(), do_release(c1), do_release(c2))
assert ['release', 'release', 'wait_closed'] == ops
assert 0 == pool.freesize
assert pool.closed


@pytest.mark.run_loop
Expand Down

0 comments on commit 7b08db8

Please sign in to comment.