From 1d99ec95b5a7f0e5a5e4d6bf6c524e179ee24662 Mon Sep 17 00:00:00 2001 From: risson <18313093+rissson@users.noreply.github.com> Date: Thu, 17 Aug 2023 19:38:39 +0200 Subject: [PATCH] root: always use persistent database connections (#6560) * root: always use persistent database connections Signed-off-by: Marc 'risson' Schmitt * root: activate database connection health checks Signed-off-by: Marc 'risson' Schmitt --------- Signed-off-by: Marc 'risson' Schmitt --- authentik/root/settings.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 0302b3116..4e6514144 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -279,14 +279,15 @@ DATABASES = { "SSLROOTCERT": CONFIG.get("postgresql.sslrootcert"), "SSLCERT": CONFIG.get("postgresql.sslcert"), "SSLKEY": CONFIG.get("postgresql.sslkey"), + # https://docs.djangoproject.com/en/4.0/ref/databases/#persistent-connections + "CONN_MAX_AGE": None, + "CONN_HEALTH_CHECKS": True, } } if CONFIG.get_bool("postgresql.use_pgbouncer", False): # https://docs.djangoproject.com/en/4.0/ref/databases/#transaction-pooling-server-side-cursors DATABASES["default"]["DISABLE_SERVER_SIDE_CURSORS"] = True - # https://docs.djangoproject.com/en/4.0/ref/databases/#persistent-connections - DATABASES["default"]["CONN_MAX_AGE"] = None # persistent # Email # These values should never actually be used, emails are only sent from email stages, which