diff options
author | Christopher Baines <mail@cbaines.net> | 2022-04-09 22:36:16 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-04-09 22:36:16 +0100 |
commit | de4a303beedc3414d7ca9a8ad948d0fc676e7e77 (patch) | |
tree | 231d5fa18f74bfc98e2b47f2220403e9237c834e /guix-build-coordinator/agent-messaging | |
parent | 777edfcb5e0a83add6ef28da18f9c767a41845e6 (diff) | |
download | build-coordinator-de4a303beedc3414d7ca9a8ad948d0fc676e7e77.tar build-coordinator-de4a303beedc3414d7ca9a8ad948d0fc676e7e77.tar.gz |
Add a timeout for submitting outputs
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http.scm | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 21b64d1..2c07336 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -339,27 +339,30 @@ (seek file-port bytes SEEK_SET) (log 'INFO "resuming upload from byte " bytes)) - (let-values (((response body) - (call-with-streaming-http-request - (uri #:resume? (integer? bytes)) - (lambda (port) - (with-time-logging - (simple-format #f "sending ~A" file) - (dump-port file-port port - #:buffer-size 65536))) - #:headers `((Authorization . ,auth-value)) - #:method (if bytes 'POST 'PUT) - #:report-bytes-sent report-bytes-sent))) - (when (>= (response-code response) 400) - (raise-exception - (make-exception-with-message - (coordinator-handle-failed-request - log - 'PUT - (uri-path - (uri #:resume? (integer? bytes))) - response - body)))))))))) + (with-timeout (* 20 60) ; 20 minutes + (raise-exception + (make-exception-with-message "timeout submitting output")) + (let-values (((response body) + (call-with-streaming-http-request + (uri #:resume? (integer? bytes)) + (lambda (port) + (with-time-logging + (simple-format #f "sending ~A" file) + (dump-port file-port port + #:buffer-size 65536))) + #:headers `((Authorization . ,auth-value)) + #:method (if bytes 'POST 'PUT) + #:report-bytes-sent report-bytes-sent))) + (when (>= (response-code response) 400) + (raise-exception + (make-exception-with-message + (coordinator-handle-failed-request + log + 'PUT + (uri-path + (uri #:resume? (integer? bytes))) + response + body))))))))))) #:times 100 #:delay (random 15))) |