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.
This commit is contained in:
parent
8e9f1af89b
commit
7db6a8fa03
1 changed files with 24 additions and 2 deletions
|
|
@ -94,8 +94,30 @@
|
||||||
(if (string-contains s "\n")
|
(if (string-contains s "\n")
|
||||||
(let ((output (string-append buffer s)))
|
(let ((output (string-append buffer s)))
|
||||||
(set! buffer "") ; clear the buffer
|
(set! buffer "") ; clear the buffer
|
||||||
|
(catch #t
|
||||||
|
(lambda ()
|
||||||
(insert job-id output)
|
(insert job-id output)
|
||||||
(display output output-port))
|
(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))))
|
(set! buffer (string-append buffer s))))
|
||||||
|
|
||||||
(exec-query
|
(exec-query
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue