From 51277fa41d8cafc96e4c407db9db6037bdf0fa4e Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Wed, 16 Jul 2025 14:26:50 +0100 Subject: [PATCH] Update --- ENTRY | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/ENTRY b/ENTRY index 8e39f7a..87a3149 100644 --- a/ENTRY +++ b/ENTRY @@ -20,8 +20,7 @@ (add-to-load-path (string-append (current-toplevel) "/lib")) ;; Put whatever you want to be called before server running here -(get "/" - (lambda () +(define* (get-content #:key non-blocking?) (let* ((uri (string->uri (string-append @@ -34,12 +33,20 @@ (socket (open-socket-for-uri uri))) - ;; If you comment out the following line, this example will work - (fcntl socket F_SETFL (logior O_NONBLOCK (fcntl socket F_GETFL))) + (when non-blocking? + (fcntl socket F_SETFL (logior O_NONBLOCK (fcntl socket F_GETFL)))) (let ((response body (http-get uri #:port socket #:streaming? #t))) - (simple-format #f "~A" (json->scm body)))))) + (json->scm body)))) + +(get "/" + (lambda () + (simple-format #f "~A" (get-content #:non-blocking? #t)))) + +(get "/working" + (lambda () + (simple-format #f "~A" (get-content #:non-blocking? #f))))