1
0
Fork 0

automatically cleanup idle connections

This is to fix a nextcloud bug that leaves idle connections open which eats into the available
postgres connection pool.
This commit is contained in:
ibizaman 2023-11-24 02:16:49 -08:00
parent 4da060986a
commit 845017103f

View file

@ -47,6 +47,14 @@ in
config = config =
let let
commonConfig = {
services.postgresql.settings = {
idle_in_transaction_session_timeout = "30s";
idle_session_timeout = "30s";
track_io_timing = "true";
};
};
tcpConfig = { tcpConfig = {
services.postgresql.enableTCPIP = true; services.postgresql.enableTCPIP = true;
services.postgresql.authentication = lib.mkOverride 10 '' services.postgresql.authentication = lib.mkOverride 10 ''
@ -102,6 +110,7 @@ in
in in
lib.mkMerge ( lib.mkMerge (
[ [
commonConfig
(dbConfig cfg.ensures) (dbConfig cfg.ensures)
(pwdConfig cfg.ensures) (pwdConfig cfg.ensures)
(lib.mkIf cfg.enableTCPIP tcpConfig) (lib.mkIf cfg.enableTCPIP tcpConfig)