Opened 6 days ago

Closed 6 days ago

#36003 closed New feature (wontfix)

Add `connection_closed` or `pre_connection_closed` and `post_connection_closed` signals

Reported by: Tomasz Wójcik Owned by: Tomasz Wójcik
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Currently I'm facing an issue with stale DB connections. It's probably related to my setup. Having connection_closed signal would simplify my debugging process.

Since 2009, there's connection_created signal.

https://github.com/django/django/blame/6f38697f90a14f1450a71c1e40aea0f5df7dca86/django/db/backends/signals.py

I'd like to create a connection_closed signal and connect it here

https://github.com/django/django/blob/6f38697f90a14f1450a71c1e40aea0f5df7dca86/django/db/backends/base/base.py#L314

This way the connection can be accessed right before closing it.

I'd be happy to implement it. Let me know what you think.

I'm also open to pre_connection_closed and post_connection_closed. Even though not many people will ever use it, I can imagine wanting both in different cases.

Change History (1)

comment:1 by Sarah Boyce, 6 days ago

Resolution: wontfix
Status: assignedclosed

Can you propose and discuss the idea with the community on the Django Forum? There you'll reach a broader audience and receive additional feedback.

If the community agrees with the proposal, please return to this ticket and reference the forum discussion so we can re-open it. For more information, please refer to the documented guidelines for requesting features.

Note: See TracTickets for help on using tickets.
Back to Top