best approach for content phase handler to run again with event timer & ngx_done?
Maxim Dounin
mdounin at mdounin.ru
Tue Jun 3 11:57:10 UTC 2014
Hello!
On Mon, Jun 02, 2014 at 11:05:14AM -0700, bsfranks at gmail.com wrote:
[...]
> So, it seems like some of what you've recommended (incrementing req count,
> and having finalize_request called) is then being done.
>
> This seemed to work correctly and each time the event handler triggered,
> the content phase handler was called again. However, is calling
> core_run_phases() a poor/dangerous approach or not recommended?
While the code above will likely work (at least with the current
nginx code), I don't think it's a good approach. I would rather
recommend using a separate function to do a "delayed" work, much
like it's done when reading a response body.
> Also, is there a recommended lower bound for the millisecond timer? For
> example, don't make it smaller than X ms, otherwise the event cycle gets
> run too frequently?
It's better to avoid timers altogether, if possible, and use
events instead. If not possible, something like 100ms should be
good enough.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list