aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-07 17:37:38 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-07 17:38:57 +0100
commit7db6a8fa03624ff21bf26598f340d24c8653a9cf (patch)
treede371e57e06e3cd6daf8f5cfce7aea6441e5a5d4
parent8e9f1af89b42fa073e84ef972ede9bfdd86e3caf (diff)
downloaddata-service-7db6a8fa03624ff21bf26598f340d24c8653a9cf.tar
data-service-7db6a8fa03624ff21bf26598f340d24c8653a9cf.tar.gz
Guard against errors when inserting log data
PostgreSQL seems to be unhappy with some data, I guess because it gets a bit jumbled. Rather than failing the job, or getting stuck not inserting logs, try and capture the error, log the details, and then keep going.
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm26
1 files changed, 24 insertions, 2 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index 91183e5..6731abf 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -94,8 +94,30 @@
(if (string-contains s "\n")
(let ((output (string-append buffer s)))
(set! buffer "") ; clear the buffer
- (insert job-id output)
- (display output output-port))
+ (catch #t
+ (lambda ()
+ (insert job-id output)
+ (display output output-port))
+ (lambda (key . args)
+ (display
+ (simple-format
+ #f
+ "
+error: ~A: ~A
+error: could not insert log part: '~A'\n\n"
+ key args output)
+ output-port)
+ (catch #t
+ (lambda ()
+ (insert
+ job-id
+ (simple-format
+ #f
+ "
+guix-data-service: error: missing log line: ~A
+\n" key)))
+ (lambda ()
+ #t)))))
(set! buffer (string-append buffer s))))
(exec-query