From d06230fcf4fbea966966479795d5d781a156df6f Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 23 Oct 2022 11:28:37 +0100 Subject: Close postgresql connections when the thread pool thread is idle I think the idle connections associated with idle threads are still taking up memory, so especially now that you can configure an arbitrary number of threads (and thus connections), I think it's good to close them regularly. --- scripts/guix-data-service.in | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in index 5f0dc25..0a8ca28 100644 --- a/scripts/guix-data-service.in +++ b/scripts/guix-data-service.in @@ -182,7 +182,13 @@ (assoc-ref opts 'show-error-details)) (%thread-pool-threads - (assoc-ref opts 'thread-pool-threads))) + (assoc-ref opts 'thread-pool-threads)) + (%thread-pool-idle-seconds + 120) + (%thread-pool-idle-thunk + (lambda () + (close-thread-postgresql-connection)))) + (let* ((startup-completed (make-atomic-box -- cgit v1.2.3