diff options
author | Christopher Baines <mail@cbaines.net> | 2023-04-27 10:31:09 +0200 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-04-27 10:31:09 +0200 |
commit | 9f080524bca10d4860058b475ae994146f4e57cd (patch) | |
tree | 0f6a29e4ae8d04187979797a3f35ee959a0e3198 /scripts/guix-data-service.in | |
parent | 4fa7a3601e957aa4d945c7414f98728da2094b67 (diff) | |
download | data-service-9f080524bca10d4860058b475ae994146f4e57cd.tar data-service-9f080524bca10d4860058b475ae994146f4e57cd.tar.gz |
Split the thread pool used for database connections
In to two thread pools, a default one, and one reserved for essential
functionality.
There are some pages that use slow queries, so this should help stop those
pages block other operations.
Diffstat (limited to 'scripts/guix-data-service.in')
-rw-r--r-- | scripts/guix-data-service.in | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in index 23886b7..adfc3d3 100644 --- a/scripts/guix-data-service.in +++ b/scripts/guix-data-service.in @@ -180,16 +180,7 @@ (current-error-port)) #f))) (%show-error-details - (assoc-ref opts 'show-error-details)) - - (%thread-pool-threads - (assoc-ref opts 'thread-pool-threads)) - (%thread-pool-idle-seconds - 60) - (%thread-pool-idle-thunk - (lambda () - (close-thread-postgresql-connection)))) - + (assoc-ref opts 'show-error-details))) (let* ((startup-completed (make-atomic-box @@ -208,11 +199,27 @@ (assq-ref opts 'host) (assq-ref opts 'port)) - (start-guix-data-service-web-server - (assq-ref opts 'port) - (assq-ref opts 'host) - (assq-ref opts 'secret-key-base) - startup-completed)) + (parameterize + ((thread-pool-channel + (make-thread-pool-channel + (floor (/ (assoc-ref opts 'thread-pool-threads) + 2)) + #:idle-seconds 60 + #:idle-thunk + close-thread-postgresql-connection)) + + (reserved-thread-pool-channel + (make-thread-pool-channel + (floor (/ (assoc-ref opts 'thread-pool-threads) + 2)) + #:idle-seconds 60 + #:idle-thunk + close-thread-postgresql-connection))) + (start-guix-data-service-web-server + (assq-ref opts 'port) + (assq-ref opts 'host) + (assq-ref opts 'secret-key-base) + startup-completed))) #:statement-timeout (assq-ref opts 'postgresql-statement-timeout))))) |