aboutsummaryrefslogtreecommitdiff
path: root/guix-build-coordinator/agent-messaging/http.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix-build-coordinator/agent-messaging/http.scm')
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm64
1 files changed, 11 insertions, 53 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index 9e1205e..3f539c4 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -263,60 +263,18 @@
(with-store store
(query-path-info store file)))
- ;; For small outputs, compress while sending the data, but for bigger
- ;; store items, do all the compression up front to hopefully reduce the
- ;; time to send them.
- (if (< (path-info-nar-size path-info)
- 1000000) ; 1MB
- (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 6
- #:delay 15)
- (let* ((directory (or (getenv "TMPDIR") "/tmp"))
- (template (string-append directory
- "/guix-build-coordinator-file.XXXXXX"))
- (out (mkstemp! template)))
- (log 'INFO "compressing " file " -> " template " prior to sending")
- (call-with-lzip-output-port out
+ (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)
- (close-port out)
-
- (log 'INFO "finished compressing " file ", now sending")
- (retry-on-error
- (lambda ()
- (call-with-input-file template
- (lambda (file-port)
- (let-values (((response body)
- (call-with-streaming-http-request
- uri
- (lambda (port)
- (with-time-logging
- (simple-format #f "sending ~A" file)
- (dump-port file-port port
- #:buffer-size 65536)))
- #:headers `((Authorization . ,auth-value)))))
- (when (>= (response-code response) 400)
- (raise-exception
- (make-exception-with-message
- (coordinator-handle-failed-request log
- 'PUT
- (uri-path uri)
- response
- body))))))))
- #:times 12
- #:delay (random 15))
-
- (delete-file template))))
+ #:level 9))
+ #:headers `((Authorization . ,auth-value))))
+ #:times 12
+ #:delay (random 15)))
args))
(define-method (submit-log-file
@@ -355,7 +313,7 @@
(call-with-input-file file
(lambda (file-port)
(dump-port file-port request-port
- #:buffer-size 65536))
+ #:buffer-size (expt 2 20)))
#:binary #t))
#:headers `((Authorization . ,auth-value)))))
(if (>= (response-code response) 400)