aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm31
1 files changed, 28 insertions, 3 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index dd54c41..2ef8500 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -108,6 +108,7 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
(forward-invocation))))))
(define* (progress-reporter/hash size log-port
+ force-output-to-log-port
#:key (progress-interval
(make-time time-duration 0 20)))
(define total 0)
@@ -117,7 +118,7 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
(format #f "~a~%" transferred))
(display message log-port) ;should be atomic
- (force-output log-port))
+ (force-output-to-log-port))
(progress-reporter
(start (lambda ()
@@ -639,10 +640,22 @@ port. Also, the port used can be changed by passing the --port option.\n"
#:code 200
#:headers '((content-type . (text/plain))))
(lambda (response-port)
+ ;; Make sure NGinx gets the response headers
+ (force-output (request-port request))
+
;; Compute the hash of the file
(let* ((reporter (progress-reporter/hash
(stat:size (stat tmp-output-file-name))
- response-port))
+ response-port
+ (lambda ()
+ (force-output response-port)
+ ;; TODO because the chunked output port
+ ;; doesn't call force-output on the
+ ;; underlying port, do that here. We
+ ;; want this event to be sent now,
+ ;; rather than when some buffer fills
+ ;; up.
+ (force-output (request-port request)))))
(hash
(call-with-worker-thread
chunked-request-channel
@@ -720,10 +733,22 @@ port. Also, the port used can be changed by passing the --port option.\n"
#:code 200
#:headers '((content-type . (text/plain))))
(lambda (response-port)
+ ;; Make sure NGinx gets the response headers
+ (force-output (request-port request))
+
;; Compute the hash of the file
(let* ((reporter (progress-reporter/hash
(stat:size (stat tmp-output-file-name))
- response-port))
+ response-port
+ (lambda ()
+ (force-output response-port)
+ ;; TODO because the chunked output port
+ ;; doesn't call force-output on the
+ ;; underlying port, do that here. We
+ ;; want this event to be sent now,
+ ;; rather than when some buffer fills
+ ;; up.
+ (force-output (request-port request)))))
(hash
(call-with-worker-thread
chunked-request-channel