diff options
author | Christopher Baines <mail@cbaines.net> | 2020-10-03 09:22:29 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-10-03 09:22:29 +0100 |
commit | 18b6dd9e6d4463e47ce457187d956c1c3dd8dd08 (patch) | |
tree | 9739842c3564438794fb736fbcfa2382cb6ff19c /scripts | |
parent | 9723a18df426417476f043b026c58755629c4887 (diff) | |
download | data-service-18b6dd9e6d4463e47ce457187d956c1c3dd8dd08.tar data-service-18b6dd9e6d4463e47ce457187d956c1c3dd8dd08.tar.gz |
Stop opening a PostgreSQL connection per request
This was good in that it avoided having to deal with long running connections,
but it probably takes some time to open the connection, and these changes are
a step towards offloading the PostgreSQL queries to other threads, so they
don't block the threads for fibers.
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/guix-data-service.in | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in index 70274d0..d3ed0d8 100644 --- a/scripts/guix-data-service.in +++ b/scripts/guix-data-service.in @@ -31,6 +31,7 @@ (gcrypt pk-crypto) (guix pki) (guix-data-service config) + (guix-data-service database) (guix-data-service web server) (guix-data-service web controller) (guix-data-service web nar controller)) @@ -194,9 +195,12 @@ (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) - #:postgresql-statement-timeout + (with-postgresql-connection-per-thread + "web" + (lambda () + (start-guix-data-service-web-server + (assq-ref opts 'port) + (assq-ref opts 'host) + (assq-ref opts 'secret-key-base))) + #:statement-timeout (assq-ref opts 'postgresql-statement-timeout)))) |