aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-08-29 15:10:03 +0100
committerChristopher Baines <mail@cbaines.net>2023-08-29 15:10:03 +0100
commit962364bcb5aca3bb639c48b8e098f54c7e458472 (patch)
treec4be50d8ee7c66e557b9d8fa376c57ea68c61d92
parent1f2c60c85b2b24d2dcb66133fd50bbdedcaacdbd (diff)
downloadbuild-coordinator-962364bcb5aca3bb639c48b8e098f54c7e458472.tar
build-coordinator-962364bcb5aca3bb639c48b8e098f54c7e458472.tar.gz
Exit when the server fails to start
To avoid the process half working.
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm21
1 files changed, 7 insertions, 14 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index aaa88cb..e2e752c 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -160,7 +160,12 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
(length (all-threads)))
(call-with-delay-logging port-metrics-updater))
- (call-with-error-handling
+ (with-exception-handler
+ (lambda (exn)
+ (simple-format
+ (current-error-port)
+ "exception when starting: ~A\n" exn)
+ (primitive-exit 1))
(lambda ()
(run-server/patched
(lambda (request body)
@@ -182,19 +187,7 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
update-managed-metrics!)))
#:host host
#:port port))
- #:on-error 'backtrace
- #:post-error (lambda (key . args)
- (when (eq? key 'system-error)
- (match args
- (("bind" "~A" ("Address already in use") _)
- (simple-format
- (current-error-port)
- "\n
-error: guix-build-coordinator could not start, as it could not bind to port ~A
-
-Check if it's already running, or whether another process is using that
-port. Also, the port used can be changed by passing the --port option.\n"
- port)))))))
+ #:unwind? #t))
(define* (render-json json #:key (extra-headers '())
(code 200))