aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-04-27 16:55:20 +0100
committerChristopher Baines <mail@cbaines.net>2020-04-27 16:55:20 +0100
commit63b0fa9c37a5cd540bcbb975598baa8ef1a3831b (patch)
treef20fe6746e4ee856deaed776a0b5dc775d460d6d
parent43312f9d977aac0f35bc5ce9b63e81cd5116d980 (diff)
downloadbuild-coordinator-63b0fa9c37a5cd540bcbb975598baa8ef1a3831b.tar
build-coordinator-63b0fa9c37a5cd540bcbb975598baa8ef1a3831b.tar.gz
Revert "Read chunked request bodies in different threads to avoid blocking"
This didn't help, as I think the web server just processes requests sequentially. Hopefully once that's resolved, this won't be necessary. This reverts commit 48ed0eead59119c269993dbfa2c9ca8302b52d3d.
-rw-r--r--guix-build-coordinator/agent-messaging/http.scm61
1 files changed, 20 insertions, 41 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm
index 7d61ab4..a47c60d 100644
--- a/guix-build-coordinator/agent-messaging/http.scm
+++ b/guix-build-coordinator/agent-messaging/http.scm
@@ -81,12 +81,6 @@ if there was no request body."
(define hook-channel
(make-hook-channel datastore hooks))
- (define chunked-request-channel
- ;; I can't work out how to stop the blocking when reading the chunked
- ;; request bodies, so just do it in a different thread.
- (make-worker-thread-channel (const '())
- #:parallelism 4))
-
(trigger-build-allocation)
(call-with-error-handling
(lambda ()
@@ -105,8 +99,7 @@ if there was no request body."
secret-key-base
datastore
trigger-build-allocation
- hook-channel
- chunked-request-channel)))
+ hook-channel)))
'fibers
(list #:host host
#:port port)))
@@ -154,8 +147,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
secret-key-base
datastore
trigger-build-allocation
- hook-channel
- chunked-request-channel)
+ hook-channel)
(define (authenticated? uuid request)
(let* ((authorization-base64
(match (assq-ref (request-headers request)
@@ -256,21 +248,15 @@ port. Also, the port used can be changed by passing the --port option.\n"
(let ((output-file-name
(build-log-file-location datastore uuid format)))
(mkdir-p (dirname output-file-name))
- (if (call-with-worker-thread
- chunked-request-channel
- (lambda ()
- (call-with-output-file output-file-name
- (lambda (output-port)
- (let loop ((line (get-line body)))
- (unless (eof-object? line)
- (base64-decode line
- base64-alphabet
- output-port)
- (loop (get-line body))))))))
- (no-content)
- (render-json
- "error"
- #:code 500)))
+ (call-with-output-file output-file-name
+ (lambda (output-port)
+ (let loop ((line (get-line body)))
+ (unless (eof-object? line)
+ (base64-decode line
+ base64-alphabet
+ output-port)
+ (loop (get-line body))))))
+ (no-content))
(render-json
"access denied"
#:code 403))))
@@ -281,22 +267,15 @@ port. Also, the port used can be changed by passing the --port option.\n"
(let ((output-file-name
(build-output-file-location datastore uuid output-name)))
(mkdir-p (dirname output-file-name))
- (if (call-with-worker-thread
- chunked-request-channel
- (lambda ()
- (call-with-output-file output-file-name
- (lambda (output-port)
- (let loop ((line (get-line body)))
- (unless (eof-object? line)
- (base64-decode line
- base64-alphabet
- output-port)
- (loop (get-line body))))))
- #t))
- (no-content)
- (render-json
- "error"
- #:code 500)))
+ (call-with-output-file output-file-name
+ (lambda (output-port)
+ (let loop ((line (get-line body)))
+ (unless (eof-object? line)
+ (base64-decode line
+ base64-alphabet
+ output-port)
+ (loop (get-line body))))))
+ (no-content))
(render-json
"access denied"
#:code 403))))