aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-10-09 19:28:06 +0100
committerChristopher Baines <mail@cbaines.net>2020-10-09 19:28:06 +0100
commitda8586f62d46c72ec55479ef01587eabe434f32a (patch)
tree56265bd34a86b87870dec67be98e37024d050619
parent2c463fcdab78412f65459f37398a185b1ee6a311 (diff)
downloaddata-service-da8586f62d46c72ec55479ef01587eabe434f32a.tar
data-service-da8586f62d46c72ec55479ef01587eabe434f32a.tar.gz
Guard against errors when recording job stderr output
This might help at least handle errors when inserting data in to PostgreSQL.
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm29
1 files changed, 26 insertions, 3 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index 1a29add..de9d4a8 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -173,9 +173,32 @@ VALUES (nextval('" (log-part-sequence-name job_id) "'), $1, $2)")
(let loop ((line (get-line port-to-read-from)))
(let ((line-with-newline
(string-append line "\n")))
- (insert logging-conn job-id line-with-newline)
- (display line-with-newline real-output-port))
- (loop (get-line port-to-read-from)))))))3
+ (catch #t
+ (lambda ()
+ (insert logging-conn job-id line-with-newline)
+ (display line-with-newline real-output-port))
+ (lambda (key . args)
+ (display
+ (simple-format
+ #f
+ "
+error: ~A: ~A
+error: could not insert log part: '~A'\n\n"
+ key args line)
+ real-output-port)
+ (catch #t
+ (lambda ()
+ (insert
+ logging-conn
+ job-id
+ (simple-format
+ #f
+ "
+guix-data-service: error: missing log line: ~A
+\n" key)))
+ (lambda ()
+ #t)))))
+ (loop (get-line port-to-read-from)))))))
port-to-write-to)))