From b781d0e86d154668a97182bb54aad82a5437ead5 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 17 Jul 2025 09:55:19 +0100 Subject: [PATCH] Add an example slow endpoint to help with testing How other things handle slow responses. --- guix-data-service/web/controller.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 8e9067f..608a4e0 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -874,6 +874,21 @@ (('GET "compare-by-datetime" _ ...) (delegate-to compare-controller)) (('GET "jobs" _ ...) (delegate-to jobs-controller)) (('GET "job" job-id) (delegate-to jobs-controller)) + ;; Example slow endpoint to help with testing + (('GET "slow") + (list (build-response + #:code 200 + #:headers '((content-type . (text/plain + (charset . "utf-8"))) + (vary . (accept)))) + (lambda (port) + (force-output port) + (for-each + (lambda (i) + (put-string port (simple-format #f "slow ~A\n" i)) + (force-output port) + (sleep 5)) + (iota 12))))) (('GET _ ...) (delegate-to nar-controller)) ((method path ...) (render-html