[tbnl-devel] send-headers and slow page generation

Yannick Gingras ygingras at ygingras.net
Sun May 14 15:52:51 UTC 2006


Hi, 

I'd like to use TBNL for a web application that have a really slow
page generation rate.  At first I thought that send-headers was the
solution: write the page header and navigation before launching the
slow content generation and then write the content as it is generated.
I made this small example (using cl-who):

(defun test-page ()
  (with-html-output (*standard-output* (send-headers) :prologue t :indent t)
    (:html (:body (:p (sleep 3) (fmt "hi, i'm the ~dth loop" 0))
		  (:p (sleep 3) (fmt "hi, i'm the ~dth loop" 1))
		  (:p (sleep 3) (fmt "hi, i'm the ~dth loop" 2))
		  (finish-output *standard-output*)
		  (:p (sleep 3) (fmt "hi, i'm the ~dth loop" 3))
		  (:p (sleep 3) (fmt "hi, i'm the ~dth loop" 4))
		  (:p (sleep 3) (fmt "hi, i'm the ~dth loop" 5))))))

Running it (without the call to send-headers) in my REPL have the
desired result: each part is printer before the next call to sleep.
On the other hand, when I try it live with TBNL I have to wait for the
whole page to be generated.  Maybe is misinterpreted the
documentation.  Is it possible to write partial pages to the client
stream with TBNL?

I'm using apache2 with the latest mod_lisp2 and TBNL 0.9.9 on a
Debian Etch system.

-- 
Yannick Gingras



More information about the Tbnl-devel mailing list