aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-06-23 09:21:10 +0100
committerChristopher Baines <mail@cbaines.net>2024-06-23 09:21:10 +0100
commit7f3e0949c43f464b7562c77364a14d7b5dfd0c4a (patch)
treef48f730119594e1e7f14af518d73c5f47727b856
parent1033db60ca7d1541a9ac8908458d92865a4db9a3 (diff)
downloadbuild-coordinator-7f3e0949c43f464b7562c77364a14d7b5dfd0c4a.tar
build-coordinator-7f3e0949c43f464b7562c77364a14d7b5dfd0c4a.tar.gz
Remove support for chunked requests
This was a hack to work around reading the entire request/response body in to memory, and is no longer needed.
-rw-r--r--guix-build-coordinator/agent-messaging/http/server.scm55
-rw-r--r--guix-build-coordinator/coordinator.scm25
2 files changed, 14 insertions, 66 deletions
diff --git a/guix-build-coordinator/agent-messaging/http/server.scm b/guix-build-coordinator/agent-messaging/http/server.scm
index 85ba0d4..51ac6ac 100644
--- a/guix-build-coordinator/agent-messaging/http/server.scm
+++ b/guix-build-coordinator/agent-messaging/http/server.scm
@@ -135,7 +135,6 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
(define (http-agent-messaging-start-server port host secret-key-base
build-coordinator
- chunked-request-channel
output-hash-channel)
(define plain-metrics-registry
(make-metrics-registry))
@@ -183,7 +182,6 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
body
secret-key-base
build-coordinator
- chunked-request-channel
output-hash-channel
update-managed-metrics!
plain-metrics-registry)))
@@ -614,7 +612,6 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
body
secret-key-base
build-coordinator
- chunked-request-channel
output-hash-channel
update-managed-metrics!
plain-metrics-registry)
@@ -794,18 +791,9 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
body)))
(call-with-output-file tmp-output-file-name
(lambda (output-port)
- ;; Older agents may still attempt to use chunked encoding
- ;; for this request
- (if (member '(chunked) (request-transfer-encoding request))
- (call-with-worker-thread
- chunked-request-channel
- (lambda ()
- (dump-port body-port
- output-port
- (request-content-length request))))
- (dump-port body-port
- output-port
- (request-content-length request))))))
+ (dump-port body-port
+ output-port
+ (request-content-length request)))))
(rename-file tmp-output-file-name
output-file-name)
(no-content))
@@ -852,20 +840,12 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
"deleting " tmp-output-file-name)
(delete-file tmp-output-file-name))
- (if (member '(chunked) (request-transfer-encoding request))
- ;; Older agents may use chunked encoding for this request
- (call-with-worker-thread
- chunked-request-channel
- (lambda ()
- (receive-file body
- #f
- tmp-output-file-name)))
- (let ((content-length
- (request-content-length request)))
- (when (> content-length 0)
- (receive-file body
- content-length
- tmp-output-file-name))))
+ (let ((content-length
+ (request-content-length request)))
+ (when (> content-length 0)
+ (receive-file body
+ content-length
+ tmp-output-file-name)))
(if (file-exists? output-file-name)
(render-json
@@ -945,19 +925,10 @@ INTERVAL (a time-duration object), otherwise does nothing and returns #f."
"deleting " output-file-name)
(delete-file output-file-name))
- (if (member '(chunked) (request-transfer-encoding request))
- ;; Older agents may use chunked encoding for this request
- (call-with-worker-thread
- chunked-request-channel
- (lambda ()
- (receive-file body
- #f
- tmp-output-file-name
- #:append? #t)))
- (receive-file body
- (request-content-length request)
- tmp-output-file-name
- #:append? #t)))
+ (receive-file body
+ content-length
+ tmp-output-file-name
+ #:append? #t))
(if (file-exists? output-file-name)
(render-json
diff --git a/guix-build-coordinator/coordinator.scm b/guix-build-coordinator/coordinator.scm
index f4b8e9f..2d7f3d9 100644
--- a/guix-build-coordinator/coordinator.scm
+++ b/guix-build-coordinator/coordinator.scm
@@ -502,29 +502,7 @@
;; Create some worker thread channels, which need to be created prior
;; to run-fibers being called.
- (let ((chunked-request-channel
- ;; There are fibers issues when trying to read the chunked
- ;; requests, so do this in dedicated threads.
- (make-worker-thread-channel
- (const '())
- #:name "chunked request"
- #:parallelism 16
- #:log-exception?
- (lambda (exn)
- (not
- (chunked-input-ended-prematurely-error?
- exn)))
- #:delay-logger
- (lambda (seconds-delayed)
- (log-delay "chunked request channel"
- seconds-delayed)
- (when (> seconds-delayed 0.1)
- (format
- (current-error-port)
- "warning: chunked request channel delayed by ~1,2f seconds~%"
- seconds-delayed)))))
-
- (output-hash-channel
+ (let ((output-hash-channel
(make-output-hash-channel
build-coordinator)))
@@ -589,7 +567,6 @@
host
secret-key-base
build-coordinator
- chunked-request-channel
output-hash-channel)
(log-msg 'INFO "listening on " host ":" port))))