diff options
author | Christopher Baines <mail@cbaines.net> | 2024-07-16 17:16:22 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2024-07-16 17:16:22 +0100 |
commit | 5f8cd2dc5642ce99a535ea6b3001a359096d6975 (patch) | |
tree | 4a496e99aa197cf73f48400a24379386926ba890 | |
parent | bbbcea8ff694c03aabb365339c31e95b272281d6 (diff) | |
download | data-service-5f8cd2dc5642ce99a535ea6b3001a359096d6975.tar data-service-5f8cd2dc5642ce99a535ea6b3001a359096d6975.tar.gz |
Stream the package derivation page since it can be large
-rw-r--r-- | guix-data-service/web/compare/controller.scm | 3 | ||||
-rw-r--r-- | guix-data-service/web/render.scm | 16 |
2 files changed, 13 insertions, 6 deletions
diff --git a/guix-data-service/web/compare/controller.scm b/guix-data-service/web/compare/controller.scm index 901b4f9..e1fab78 100644 --- a/guix-data-service/web/compare/controller.scm +++ b/guix-data-service/web/compare/controller.scm @@ -748,7 +748,8 @@ (valid-targets->options targets) build-status-strings build-server-urls - derivation-changes)))))))))))) + derivation-changes) + #:stream? #t))))))))))) (define (render-compare-by-datetime/package-derivations mime-types query-parameters) diff --git a/guix-data-service/web/render.scm b/guix-data-service/web/render.scm index 1ec47ac..90f577e 100644 --- a/guix-data-service/web/render.scm +++ b/guix-data-service/web/render.scm @@ -139,17 +139,23 @@ #f))) (define* (render-html #:key sxml (extra-headers '()) - (code 200)) + (code 200) + stream?) (list (build-response #:code code #:headers (append extra-headers '((content-type . (text/html (charset . "utf-8"))) (vary . (accept))))) - (call-with-encoded-output-string - "utf-8" - (lambda (port) - (sxml->html sxml port))))) + (if stream? + (lambda (port) + (set-port-encoding! port "utf-8") + (setvbuf port 'block (expt 2 20)) + (sxml->html sxml port)) + (call-with-encoded-output-string + "utf-8" + (lambda (port) + (sxml->html sxml port)))))) (define* (render-json json #:key (extra-headers '()) (code 200) |