Closed Sleepful closed 7 months ago
So this won't measure the time the adapter takes to parse the request and generate the response, but if you're just interested in the time your Clojure code has taken, you could use middleware like:
(defn wrap-time [handler]
(fn [request]
(time (handler request))))
@weavejester oh, of course, so straightforward. Thank you! Still wrapping my head around the idioms 😄
Just curious, I was looking at Pedestal example to time a request:
http://pedestal.io/pedestal/0.7-pre/guides/what-is-an-interceptor.html#_sharing_information_between_phases
I was wondering if something similar could be done with Ring. My understanding is that a handler is the last function that runs before returning the request, so there can't be something after the handle (a middleware?) to measure the amount of time that it took to complete.