Writing a timer event (how to execute an event from time to time)

Piotr Sikora piotr.sikora at frickle.com
Tue May 25 13:13:06 MSD 2010


> Would you be kind enough to help me understanding how to write an
> event which executes itself from time to time, using Nginx event
> handler?
> I would like to register for each request a timer to execute a given
> task each 10 seconds.

Which one are you trying to do? Because you described two very different 

If you want to execute some function from time to time (for example every 10 
seconds) inside nginx, then you should look at the beginning of 
ngx_supervisord's code [1].

If you want to do delay response on the request, like in your example, then 
you should look at ngx_echo module [2].

> I am trying this in my module handler:
> (...)

As Weibin Yao already wrote, this is fundamentally wrong.

[1] http://labs.frickle.com/nginx_ngx_supervisord/
[2] http://wiki.nginx.org/NginxHttpEchoModule

Best regards,
Piotr Sikora < piotr.sikora at frickle.com >

More information about the nginx-devel mailing list