Opened 10 months ago
Closed 10 months ago
#35130 closed Cleanup/optimization (fixed)
Document how to manually close database connections
Reported by: | Baptiste Mispelon | Owned by: | Salvo Polizzi |
---|---|---|---|
Component: | Documentation | Version: | 5.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I was reading about manual database connection management today and came upon this section (emphasis mine) [1]:
If a connection is created in a long-running process, outside of Django’s request-response cycle, the connection will remain open until explicitly closed, or timeout occurs.
From what I understand, manually closing open db connections is done by calling django.db.close_old_connections()
, but that function does not seem to be documented officially.
I'm not sure if the function is undocumented by design (it is after all a pretty unusual use-case and most users should never have to call it themselves), or if that was just an omission.
[1] https://docs.djangoproject.com/en/dev/ref/databases/#caveats
Change History (4)
comment:1 by , 10 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 10 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
I think it's fine to at least mention it in the "Caveats" section.