[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/09: Add error handling for startup failures
From: |
Christopher Baines |
Subject: |
09/09: Add error handling for startup failures |
Date: |
Tue, 2 Apr 2024 08:23:56 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit 7f5f11048bd6d28b001f5fff31b9149f1a9e96b9
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Tue Apr 2 12:16:27 2024 +0100
Add error handling for startup failures
---
scripts/guix-data-service.in | 39 +++++++++++++++++++++++----------------
1 file 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
- branch master updated (b4583bb -> 7f5f110), Christopher Baines, 2024/04/02
- 06/09: Switch to spawn for running sqitch, Christopher Baines, 2024/04/02
- 07/09: Move sleep to start of spawn-port-monitoring-fiber, Christopher Baines, 2024/04/02
- 08/09: Guard against logging failing, Christopher Baines, 2024/04/02
- 05/09: Close unused PostgreSQL connections, Christopher Baines, 2024/04/02
- 01/09: Make changes for the guile-prometheus update, Christopher Baines, 2024/04/02
- 02/09: Stop using a inferior-package-derivations lock, Christopher Baines, 2024/04/02
- 04/09: Remove the per-thread PostgreSQL connection code, Christopher Baines, 2024/04/02
- 09/09: Add error handling for startup failures,
Christopher Baines <=
- 03/09: Move backfilling in to the server module and use the connection pool, Christopher Baines, 2024/04/02