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

**URL:** <https://forum.djangoproject.com/t/hitting-db-connection-limit-asgi-server-unicorn-django-4-2-django-ninja-async-api/40431>\
**Category:** Getting Started\
**Created:** [April 15, 2025, 11:03pm UTC](https://forum.djangoproject.com/t/hitting-db-connection-limit-asgi-server-unicorn-django-4-2-django-ninja-async-api/40431 "2025-04-15T23:03:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PVSPHANINDRA](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/pvsphanindra/32/28104_2.png) [@PVSPHANINDRA](https://forum.djangoproject.com/u/PVSPHANINDRA)\
**Post date:** [April 15, 2025, 11:03pm UTC](https://forum.djangoproject.com/t/hitting-db-connection-limit-asgi-server-unicorn-django-4-2-django-ninja-async-api/40431/1 "2025-04-15T23:03:46Z")

</div>

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.

 ![Screenshot 2025-04-15 at 3.55.59 PM](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/1/c/1ccd8412411dda24ca0faa29bc81fb4442458cbd.jpeg)

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
