From 1f69f40db0d1d65cae5880847d120baf974fbbef Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 29 Aug 2023 11:35:33 +0100 Subject: Stop closing the ports for json seq responses As this breaks reading the stream. --- guix-build-coordinator/client-communication.scm | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'guix-build-coordinator/client-communication.scm') diff --git a/guix-build-coordinator/client-communication.scm b/guix-build-coordinator/client-communication.scm index 3f59dad..61b8731 100644 --- a/guix-build-coordinator/client-communication.scm +++ b/guix-build-coordinator/client-communication.scm @@ -703,17 +703,19 @@ (set-port-encoding! body "UTF-8") (values - (let ((parsed-body - (if (equal? '(application/json-seq) - (response-content-type response)) - (json-seq->scm - body - ;; TODO I would like to use 'throw, but it always raises an - ;; exception, so this needs fixing upstream first - #:handle-truncate 'replace) - (json->scm body)))) - (close-port body) - parsed-body) + (if (equal? '(application/json-seq) + (response-content-type response)) + ;; TODO There's no mechanism to close the port after the + ;; stream/sequence has finished + (json-seq->scm + body + ;; TODO I would like to use 'throw, but it always raises an + ;; exception, so this needs fixing upstream first + #:handle-truncate 'replace) + (let ((parsed-body + (json->scm body))) + (close-port body) + parsed-body)) response)))))) (define* (send-submit-build-request -- cgit v1.2.3