Browse Source

Fixed #33497 -- Doc'd that persistent DB connections should be disabled in ASGI and async modes.

Carlton Gibson 1 week ago
parent
commit
8713e4ae96
2 changed files with 9 additions and 0 deletions
  1. 4 0
      docs/ref/databases.txt
  2. 5 0
      docs/topics/async.txt

+ 4 - 0
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
 ~~~~~~~~~~~~~~~~~~~~~
 

+ 5 - 0
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