aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2022-07-15 09:24:46 +0100
committerChristopher Baines <mail@cbaines.net>2022-07-15 09:24:46 +0100
commitee73d2cc9857533020535eb8e1ad856e04fb5152 (patch)
treed06332a1860e1204bcda20c8d65e8be038dbfc0f /guix-data-service/web
parent1962b1f61c5b72466d432f865c84334507ecc39b (diff)
downloaddata-service-ee73d2cc9857533020535eb8e1ad856e04fb5152.tar
data-service-ee73d2cc9857533020535eb8e1ad856e04fb5152.tar.gz
Return 503 for the /healthcheck if the service is starting up
As this is a little clearer.
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/controller.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm
index b6ecfa7..a29382a 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -525,7 +525,7 @@
(define (startup-controller-thunk)
(or
- (base-controller request method-and-path-components)
+ (base-controller request method-and-path-components #f)
(render-html
#:sxml (server-starting-up-page)
#:code 503)))
@@ -542,7 +542,8 @@
#f))
#:code 500))))
-(define (base-controller request method-and-path-components)
+(define* (base-controller request method-and-path-components
+ startup-completed?)
(match method-and-path-components
(('GET "assets" rest ...)
(or (handle-static-assets (string-join rest "/")
@@ -566,7 +567,9 @@
#:code (if (eq? database-status
#t)
200
- 500))))
+ (if startup-completed?
+ 500
+ 503)))))
(('GET "README")
(let ((filename (string-append (%config 'doc-dir) "/README.html")))
(if (file-exists? filename)
@@ -612,7 +615,7 @@
#:code 404)))
(or
- (base-controller request method-and-path-components)
+ (base-controller request method-and-path-components #t)
(match method-and-path-components
(('GET)
(render-html