guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Return 503 for the /healthcheck if the service is


From: Christopher Baines
Subject: branch master updated: Return 503 for the /healthcheck if the service is starting up
Date: Fri, 15 Jul 2022 04:25:17 -0400

This is an automated email from the git hooks/post-receive script.

cbaines pushed a commit to branch master
in repository data-service.

The following commit(s) were added to refs/heads/master by this push:
     new ee73d2c  Return 503 for the /healthcheck if the service is starting up
ee73d2c is described below

commit ee73d2cc9857533020535eb8e1ad856e04fb5152
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Jul 15 09:24:46 2022 +0100

    Return 503 for the /healthcheck if the service is starting up
    
    As this is a little clearer.
---
 guix-data-service/web/controller.scm | 11 +++++++----
 1 file 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]