On Thursday 11 August 2011 17:54:33 Nick Knutov wrote:
Hello all,
is it possible to run some code after sending response to upstream [and closing socket] with Dancer?
For example: I want to get request, send response and after closing socket to back-end do some job with big timeouts: write logs, send notifications via emails, etc.
Currently, no; the closest is the 'after' hook, but that runs after the route handler execution completes, but before the response is sent. It could potentially make sense for us to add a new hook which fires once the request is complete - 'after_response', or 'after_response_sent' or something vaguely like that. However, I think implementing that may be tricky thanks to the way Plack works. We'll have to have more of a think about this one :) -- David Precious ("bigpresh") http://www.preshweb.co.uk/ "Programming is like sex. One mistake and you have to support it for the rest of your life". (Michael Sinz)