aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/web
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2024-07-12 13:33:37 +0100
committerChristopher Baines <mail@cbaines.net>2024-07-12 13:33:37 +0100
commita61c4baccd14fcc809ea677d5687e1036f0ee721 (patch)
tree22e6767d9f64bb1e401e7b7ed8a52f1f6b296528 /guix-data-service/web
parent9032079bdad7300cde5d3ee8daeb88ee381a1d6b (diff)
downloaddata-service-a61c4baccd14fcc809ea677d5687e1036f0ee721.tar
data-service-a61c4baccd14fcc809ea677d5687e1036f0ee721.tar.gz
Try and speed up large package derivation comparisions
Diffstat (limited to 'guix-data-service/web')
-rw-r--r--guix-data-service/web/compare/controller.scm3
-rw-r--r--guix-data-service/web/render.scm16
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 242760b..901b4f9 100644
--- a/guix-data-service/web/compare/controller.scm
+++ b/guix-data-service/web/compare/controller.scm
@@ -731,7 +731,8 @@
(target
. ((commit . ,target-commit)))))
(derivation_changes
- . ,derivation-changes))))
+ . ,derivation-changes))
+ #:stream? #t))
(else
(letpar& ((systems
(call-with-resource-from-pool (connection-pool)
diff --git a/guix-data-service/web/render.scm b/guix-data-service/web/render.scm
index 744c66c..1ec47ac 100644
--- a/guix-data-service/web/render.scm
+++ b/guix-data-service/web/render.scm
@@ -152,17 +152,23 @@
(sxml->html sxml port)))))
(define* (render-json json #:key (extra-headers '())
- (code 200))
+ (code 200)
+ stream?)
(list (build-response
#:code code
#:headers (append extra-headers
'((content-type . (application/json
(charset . "utf-8")))
(vary . (accept)))))
- (call-with-encoded-output-string
- "utf-8"
- (lambda (port)
- (scm->json json port)))))
+ (if stream?
+ (lambda (port)
+ (set-port-encoding! port "utf-8")
+ (setvbuf port 'block (expt 2 20))
+ (scm->json json port))
+ (call-with-encoded-output-string
+ "utf-8"
+ (lambda (port)
+ (scm->json json port))))))
(define* (render-text text #:key (extra-headers '())
(code 200))