diff options
author | Christopher Baines <mail@cbaines.net> | 2024-04-02 12:16:27 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-04-02 12:16:27 +0100 |
commit | 7f5f11048bd6d28b001f5fff31b9149f1a9e96b9 (patch) | |
tree | 709ffd9592b4ec0f9682b7a4b0808ad8e88ef28f | |
parent | 65f92ca7013f2a3500f3fa66d6a47f02b253ef10 (diff) | |
download | data-service-7f5f11048bd6d28b001f5fff31b9149f1a9e96b9.tar data-service-7f5f11048bd6d28b001f5fff31b9149f1a9e96b9.tar.gz |
Add error handling for startup failures
-rw-r--r-- | scripts/guix-data-service.in | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in index 2393f1e..8a124ee 100644 --- a/scripts/guix-data-service.in +++ b/scripts/guix-data-service.in @@ -201,22 +201,29 @@ (call-with-new-thread (lambda () - (run-sqitch) - - (for-each - (lambda (git-repository-details) - (when (fifth git-repository-details) - (simple-format #t "starting thread to poll ~A (~A)\n" - (second git-repository-details) - (third git-repository-details)) - - (start-thread-to-poll-git-repository - (first git-repository-details)))) - (with-postgresql-connection - "poll-startup" - all-git-repositories)) - - (atomic-box-set! startup-completed #t))) + (with-exception-handler + (lambda (exn) + (simple-format + (current-error-port) + "startup failed: ~A\n" exn) + (exit 1)) + (lambda () + (run-sqitch) + + (for-each + (lambda (git-repository-details) + (when (fifth git-repository-details) + (simple-format #t "starting thread to poll ~A (~A)\n" + (second git-repository-details) + (third git-repository-details)) + + (start-thread-to-poll-git-repository + (first git-repository-details)))) + (with-postgresql-connection + "poll-startup" + all-git-repositories)) + + (atomic-box-set! startup-completed #t))))) ;; Provide some visual space between the startup output and the ;; server starting |