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:
parent
4da060986a
commit
845017103f
1 changed files with 9 additions and 0 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue