Skip to content

Commit 6669260

Browse files
author
pr-relay
committed
docs: clarify pooled connection lifetime
1 parent db8ecc2 commit 6669260

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

docs/usage.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,10 @@ To create a connection pool, use the
411411
The resulting :class:`Pool <asyncpg.pool.Pool>` object can then be used
412412
to borrow connections from the pool.
413413

414+
When using ``async with pool.acquire() as connection``, the connection is
415+
released back to the pool automatically when the context exits. There is no
416+
need to close the borrowed connection explicitly.
417+
414418
Below is an example of how **asyncpg** can be used to implement a simple
415419
Web service that computes the requested power of two.
416420

0 commit comments

Comments
 (0)