Hitting DB connection limit(ASGI server + unicorn + django 4.2 + django ninja async api)

I looked into various posts to solve this issue. Tried out various approaches like connection pool like pgBouncer, yet the issue persist.

The below is the latest source which I found relevant which suggests me to explicitly close the connection in the view.

Is there any other way I can do this. Additionally, what are the best practice one should follow on DB connection when they use django 4.2 + django ninja async + asgi server + unicorn