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

Rogério Schneider stockrt at gmail.com
Tue May 25 15:41:39 MSD 2010

>> 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
> things.

I thought that by adding a delay in the trigger of a "ready to write"
event I could simulate a timer. Sure, this timer would only be
triggered if the connection is ready to write on, but it would do the
work for me.

> 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 believe my code dos not delay a response, instead, it only uses a
the "ready to write" event as a start point for the timer counter.

>> I am trying this in my module handler:
>> (...)
> As Weibin Yao already wrote, this is fundamentally wrong.

I did not follow that one. What is wrong? The way I choose to set the
"event timer per request"?

Rogério Schneider

More information about the nginx-devel mailing list