[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/09: Close unused PostgreSQL connections
From: |
Christopher Baines |
Subject: |
05/09: Close unused PostgreSQL connections |
Date: |
Tue, 2 Apr 2024 08:23:56 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit 68085323388cf75e8ec2756a4f11a7005c7cd430
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Mon Apr 1 22:20:46 2024 +0100
Close unused PostgreSQL connections
As they take up memory, so free some by closing them.
---
guix-data-service/web/server.scm | 12 ++++++++++--
1 file 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))
- branch master updated (b4583bb -> 7f5f110), Christopher Baines, 2024/04/02
- 06/09: Switch to spawn for running sqitch, Christopher Baines, 2024/04/02
- 07/09: Move sleep to start of spawn-port-monitoring-fiber, Christopher Baines, 2024/04/02
- 08/09: Guard against logging failing, Christopher Baines, 2024/04/02
- 05/09: Close unused PostgreSQL connections,
Christopher Baines <=
- 01/09: Make changes for the guile-prometheus update, Christopher Baines, 2024/04/02
- 02/09: Stop using a inferior-package-derivations lock, Christopher Baines, 2024/04/02
- 04/09: Remove the per-thread PostgreSQL connection code, Christopher Baines, 2024/04/02
- 09/09: Add error handling for startup failures, Christopher Baines, 2024/04/02
- 03/09: Move backfilling in to the server module and use the connection pool, Christopher Baines, 2024/04/02