-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document connection pool best usage and caveats #129
Comments
Also see aio-libs/aiohttp#981 |
aiohttp demo polls app has been refactored lately to match the connection pool best practices. Basically it boils down to: async def index(request):
# the view function acquires the connection
async with request.app['db'].acquire() as conn:
# the connection is passed down to db utlity functions
db.do_some_query(conn) While the approach is sound and simple, I think it may encourage taking the connection out of the pool for longer than needed. I will point it out in the docs. |
Good |
Proposed patch is in #133 |
Fixed by #133 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A wrong usage of connection pool may cause deadlocks. See #113 #127 #128 for reference. Expecially issue 128 comment.
We should document what's the best way of using connection pooling and also give some example of bad usage that leads to deadlocks.
The text was updated successfully, but these errors were encountered: