ORM query make asyncpg pool create new database connection on every request.
kitlycol opened this issue · comments
- asyncorm version:
- Python version: 3.6
- Operating System: ubuntu 18.04
Description
when use asyncorm and asyncpg pool with sanic with sample query and view in browser.
in case refresh more times you will see more postgresql database connections.
async def test_view(request):
objs = SomeModel.objects.all()
items = []
async for obj in objs:
items.append(obj)
return response.json(items)
thus if wrk benchmark this view you will got:
asyncpg.exceptions.TooManyConnectionsError: sorry, too many clients already
What I Did
ps aux | grep "postgres"
fixed just release database connection from asyncpg pool
kitlycol@081d126