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.
This commit is contained in:
Christopher Baines 2022-10-23 11:28:37 +01:00
parent aaec813cba
commit d06230fcf4
3 changed files with 52 additions and 2 deletions

View file

@ -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