1
0
mirror of https://github.com/django/django.git synced 2025-02-28 19:44:35 +00:00

[4.2.x] Clarified database connections lifetime outside HTTP requests.

Backport of e901407e2369ddb16a5c866e1f2fbf8ea8acf549 from main
This commit is contained in:
Alberto Sottile 2023-05-12 13:09:38 +02:00 committed by Natalia
parent e50fe33e13
commit dbe263751c

View File

@ -31,7 +31,7 @@ Persistent connections
---------------------- ----------------------
Persistent connections avoid the overhead of reestablishing a connection to Persistent connections avoid the overhead of reestablishing a connection to
the database in each request. They're controlled by the the database in each HTTP request. They're controlled by the
:setting:`CONN_MAX_AGE` parameter which defines the maximum lifetime of a :setting:`CONN_MAX_AGE` parameter which defines the maximum lifetime of a
connection. It can be set independently for each database. connection. It can be set independently for each database.
@ -101,6 +101,10 @@ either restore Django's defaults at the end of each request, force an
appropriate value at the beginning of each request, or disable persistent appropriate value at the beginning of each request, or disable persistent
connections. connections.
If a connection is created in a long-running process, outside of Djangos
request-response cycle, the connection will remain open until explicitly
closed, or timeout occurs.
Encoding Encoding
-------- --------