ring-clojure/ring — pull request #59 by proger (2013-04-12 14:20:40+00:00)
Title: ring-servlet: introducing wip async-response macro

violates the ring spec and makes a handler return a function

usage example (using compojure):

(defroutes api
(GET "/report" {{url "url"} :query-params :as request}
(when url
(servlet/async-response
(very-long-computation-here url)
(plain-text "report here\n" (repr url) "\n" (repr request) (stack))))))

My goal here is to offload a computation to a background thread and release the servlet worker.

I'm not sure how to implement this properly (and the code is not very good Clojure as i've just started, but it kinda works) — ring says I can't return a function from the handler.

Looking forward for your comments.
Thanks.