From 3bac571faeda92b0972726c19c86fe4ef0ffd979 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 28 Apr 2020 20:11:22 +0100 Subject: Retry file uploads to the coordinator Previously SIGPIPE killed the agent. This should avoid that and have the agent retry. --- guix-build-coordinator/agent-messaging/http.scm | 40 +++++++++++++++---------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'guix-build-coordinator/agent-messaging') diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 4b569f1..a4be0b5 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -498,14 +498,18 @@ port. Also, the port used can be changed by passing the --port option.\n" coordinator-uri (string-append "/build/" build-id "/output/" output-name))) - (call-with-streaming-http-request - uri - (lambda (port) - (call-with-lzip-output-port port - (lambda (port) - (write-file file port)) - #:level 9)) - #:headers `((Authorization . ,auth-value)))) + (retry-on-error + (lambda () + (call-with-streaming-http-request + uri + (lambda (port) + (call-with-lzip-output-port port + (lambda (port) + (write-file file port)) + #:level 9)) + #:headers `((Authorization . ,auth-value)))) + #:times 3 + #:delay 30)) (define (submit-log-file coordinator-uri agent-uuid password build-id file) @@ -528,14 +532,18 @@ port. Also, the port used can be changed by passing the --port option.\n" coordinator-uri (string-append "/build/" build-id "/log/" format))) - (call-with-streaming-http-request - uri - (lambda (request-port) - (call-with-input-file file - (lambda (file-port) - (dump-port file-port request-port)) - #:binary #t)) - #:headers `((Authorization . ,auth-value)))) + (retry-on-error + (lambda () + (call-with-streaming-http-request + uri + (lambda (request-port) + (call-with-input-file file + (lambda (file-port) + (dump-port file-port request-port)) + #:binary #t)) + #:headers `((Authorization . ,auth-value)))) + #:times 3 + #:delay 30)) (define (submit-build-result coordinator-uri agent-uuid password build-id result) -- cgit v1.2.3