> 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
--
Ticket URL: <https://code.djangoproject.com/ticket/35130>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
I think it's fine to at least mention it in the "Caveats" section.
--
Ticket URL: <https://code.djangoproject.com/ticket/35130#comment:1>
* owner: nobody => Salvo Polizzi
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/35130#comment:2>
* has_patch: 0 => 1
* stage: Accepted => Ready for checkin
Comment:
[https://github.com/django/django/pull/17766 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/35130#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"184d82d8488b1b31ade5b5a68b0040f1c267f2be" 184d82d]:
{{{
#!CommitTicketReference repository=""
revision="184d82d8488b1b31ade5b5a68b0040f1c267f2be"
Fixed #35130 -- Doc'd django.db.close_old_connections().
This also adds close_db_connections() to the django.db.__all__.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35130#comment:4>