Hello!
On Fri, Oct 17, 2014 at 9:32 AM, luis.gasca wrote:
> Is it possible to run a long running callback function using ngx.timer.at or
> should I always schedule the next run using ngx.timer.at inside the callback
> ?
>
Generally the second approach is preferred. One potential problem with
the first approach is that some of the ngx_lua module's Lua API
functions can allocate small memory blocks in the current timer
handler's memory pool which means that these memory blocks will not be
freed until the current timer handler is quit and its pool is
destroyed.
But if you observe no such things as slow leaking with the first
approach in your use case, then the first approach is fine as well :)
In the long run, I'd avoid allocating in the nginx memory pools in all
the Lua API functions provided by ngx_lua.
Regards,
-agentzh