diff options
| author | Carlton Gibson <carlton.gibson@noumenal.es> | 2025-03-13 10:23:00 +0100 |
|---|---|---|
| committer | Natalia <124304+nessita@users.noreply.github.com> | 2025-03-18 21:28:07 -0300 |
| commit | c779808c8e580efdcc27d10bda1323c4ea74a8f5 (patch) | |
| tree | 2bd88daf8675bcc51407997f9a44c237247fff9e /docs | |
| parent | bcb6ada288a0faf892e9982bca478e4e0da621ae (diff) | |
[5.2.x] Fixed #33497 -- Doc'd that persistent DB connections should be disabled in ASGI and async modes.
Backport of 8713e4ae96817a0c7be3f7a8fee25a7c7f819721 from main.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/databases.txt | 4 | ||||
| -rw-r--r-- | docs/topics/async.txt | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/databases.txt b/docs/ref/databases.txt index a3571295ff..93a773e9a7 100644 --- a/docs/ref/databases.txt +++ b/docs/ref/databases.txt @@ -40,6 +40,10 @@ database connection at the end of each request. To enable persistent connections, set :setting:`CONN_MAX_AGE` to a positive integer of seconds. For unlimited persistent connections, set it to ``None``. +When using ASGI, persistent connections should be disabled. Instead, use your +database backend's built-in connection pooling if available, or investigate a +third-party connection pooling option if required. + Connection management ~~~~~~~~~~~~~~~~~~~~~ diff --git a/docs/topics/async.txt b/docs/topics/async.txt index a289344f6b..c5cbabeea7 100644 --- a/docs/topics/async.txt +++ b/docs/topics/async.txt @@ -146,6 +146,11 @@ Transactions do not yet work in async mode. If you have a piece of code that needs transactions behavior, we recommend you write that piece as a single synchronous function and call it using :func:`sync_to_async`. +:ref:`Persistent database connections <persistent-database-connections>`, set +via the :setting:`CONN_MAX_AGE` setting, should also be disabled in async mode. +Instead, use your database backend's built-in connection pooling if available, +or investigate a third-party connection pooling option if required. + .. _async_performance: Performance |
