Return 503 for the /healthcheck if the service is starting up

As this is a little clearer.
This commit is contained in:
Christopher Baines 2022-07-15 09:24:46 +01:00
parent 1962b1f61c
commit ee73d2cc98

View file

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