diff options
author | Christopher Baines <mail@cbaines.net> | 2022-10-23 11:28:37 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-10-23 11:28:37 +0100 |
commit | d06230fcf4fbea966966479795d5d781a156df6f (patch) | |
tree | 6f9cbb3e16382a7dff087c86357666e1ad55fbb1 /scripts | |
parent | aaec813cba86240d5e9e6751e1743ee4f540d998 (diff) | |
download | data-service-d06230fcf4fbea966966479795d5d781a156df6f.tar data-service-d06230fcf4fbea966966479795d5d781a156df6f.tar.gz |
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.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/guix-data-service.in | 8 |
1 files changed, 7 insertions, 1 deletions
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 |