diff options
author | Christopher Baines <mail@cbaines.net> | 2024-04-01 22:20:46 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-04-01 22:20:46 +0100 |
commit | 68085323388cf75e8ec2756a4f11a7005c7cd430 (patch) | |
tree | 41ddc49645f0335d3ff4bf143334096053ae7769 /guix-data-service/web | |
parent | 9fcd615c1f62de72474a348a0bc935e87adfaa67 (diff) | |
download | data-service-68085323388cf75e8ec2756a4f11a7005c7cd430.tar data-service-68085323388cf75e8ec2756a4f11a7005c7cd430.tar.gz |
Close unused PostgreSQL connections
As they take up memory, so free some by closing them.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r-- | guix-data-service/web/server.scm | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/guix-data-service/web/server.scm b/guix-data-service/web/server.scm index b73b186..e86b97b 100644 --- a/guix-data-service/web/server.scm +++ b/guix-data-service/web/server.scm @@ -109,7 +109,11 @@ (open-postgresql-connection "web" postgresql-statement-timeout)) - (floor (/ postgresql-connections 2)))) + (floor (/ postgresql-connections 2)) + #:idle-seconds 30 + #:destructor + (lambda (conn) + (close-postgresql-connection conn "web")))) (reserved-connection-pool (make-resource-pool @@ -117,7 +121,11 @@ (open-postgresql-connection "web-reserved" postgresql-statement-timeout)) - (floor (/ postgresql-connections 2)))) + (floor (/ postgresql-connections 2)) + #:idle-seconds 600 + #:destructor + (lambda (conn) + (close-postgresql-connection conn "web-reserved")))) (resource-pool-default-timeout 5)) |