aboutsummaryrefslogtreecommitdiff
path: root/scripts/guix-data-service.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/guix-data-service.in')
-rw-r--r--scripts/guix-data-service.in73
1 files changed, 25 insertions, 48 deletions
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in
index 6a41413..1a41bd4 100644
--- a/scripts/guix-data-service.in
+++ b/scripts/guix-data-service.in
@@ -93,11 +93,11 @@
(alist-cons 'host
arg
(alist-delete 'host result))))
- (option '("thread-pool-threads") #t #f
+ (option '("postgresql-connections") #t #f
(lambda (opt name arg result)
- (alist-cons 'thread-pool-threads
+ (alist-cons 'postgresql-connections
(string->number arg)
- (alist-delete 'thread-pool-threads
+ (alist-delete 'postgresql-connections
result))))
(option '("postgresql-statement-timeout") #t #f
(lambda (opt name arg result)
@@ -119,7 +119,7 @@
(_ #t)))
(port . 8765)
(host . "0.0.0.0")
- (thread-pool-threads . 16)
+ (postgresql-connections . 16)
(postgresql-statement-timeout . 60000)))
@@ -187,44 +187,6 @@
(if (assoc-ref opts 'update-database)
#f
#t)))
- (server-thread
- (call-with-new-thread
- (lambda ()
- (with-postgresql-connection-per-thread
- "web"
- (lambda ()
- ;; Provide some visual space between the startup output and the server
- ;; starting
- (simple-format #t "\n\nStarting the server on http://~A:~A/\n\n"
- (assq-ref opts 'host)
- (assq-ref opts 'port))
-
- (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))
-
- (thread-pool-request-timeout 10))
-
- (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)))))
(pid-file (assq-ref opts 'pid-file)))
@@ -233,11 +195,6 @@
(lambda (port)
(simple-format port "~A\n" (getpid)))))
- (when (assoc-ref opts 'update-database)
- (run-sqitch)
-
- (atomic-box-set! startup-completed #t))
-
(call-with-new-thread
(lambda ()
(with-postgresql-connection-per-thread
@@ -247,4 +204,24 @@
(start-substitute-query-threads)
- (join-thread server-thread))))
+ (when (assoc-ref opts 'update-database)
+ (call-with-new-thread
+ (lambda ()
+ (run-sqitch)
+
+ (atomic-box-set! startup-completed #t))))
+
+ ;; Provide some visual space between the startup output and the
+ ;; server starting
+ (simple-format #t "\n\nStarting the server on http://~A:~A/\n\n"
+ (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
+ #:postgresql-statement-timeout
+ (assq-ref opts 'postgresql-statement-timeout)
+ #:postgresql-connections
+ (assq-ref opts 'postgresql-connections)))))