Skip to content

Commit

Permalink
Merge branch 'master' into fix-async-iter-for-sa-connection-context-m…
Browse files Browse the repository at this point in the history
…anager
  • Loading branch information
Nothing4You authored Feb 3, 2022
2 parents e821ce2 + 30b9ea5 commit 9f7a3cb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ To be included in 1.0.0 (unreleased)
* 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
* Fixed unlimited Pool size not working, this is now working as documented by passing maxsize=0 to create_pool #119
* Added Pool.closed property as present in aiopg #463
* Fixed SQLAlchemy connection context iterator #410


Expand Down
9 changes: 8 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,13 @@ async def clear(self):
await conn.ensure_closed()
self._cond.notify()

@property
def closed(self):
"""
The readonly property that returns ``True`` if connections is closed.
"""
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 9f7a3cb

Please sign in to comment.