[Dancer-users] do something after sending response
Nick Knutov
mail at knutov.com
Fri Aug 12 05:49:45 CEST 2011
I agree, forking is another way to do it, but as far as I know, it can
lead to very high load. Also, dying process is a heavy operation, as far
as I remember.
12.08.2011 0:27, David Precious пишет:
> On Thursday 11 August 2011 18:17:47 David Precious wrote:
>> Another possible alternative would be to fork a new process that will do
>> the stuff in the background, whilst the original process continues
>> onwards to send the response back to the client.
>
> For the time being, at least, this is probably the easiest option.
>
> Something like:
>
> hook after => sub {
> if (fork) {
> # parent - do nothing
> } else {
> # Child - sleep for a while
> sleep 50;
> exit;
> }
> };
>
> With a quick test, that works as expected. (The exit is required, so that the
> child process doesn't then go on return control to Dancer.)
>
>
>
>
--
Best Regards,
Nick Knutov
http://knutov.com
ICQ: 272873706
Voice: +7-904-84-23-130
More information about the Dancer-users
mailing list