Hello!
On Mon, Jun 2, 2014 at 8:10 PM, Dragos Dascalita Haut wrote:
> I was reading the documentation to understand if the arguments that can be
> passed to ngx.timer.at are going to be allocated extra memory, or are simply
> passed as references ?
>
Just added some more documentation to clarify this:
https://github.com/openresty/lua-nginx-module#ngxtimerat
To quote,
"You can pass most of the standard Lua values (nils, booleans,
numbers, strings, tables, closures, file handles, and etc) into the
timer callback, either explicitly as user arguments or implicitly as
upvalues for the callback closure. There are several exceptions,
however: you cannot pass any thread objects returned
bycoroutine.create and ngx.thread.spawn or any cosocket objects
returned by ngx.socket.tcp, ngx.socket.udp, andngx.req.socket because
these objects' lifetime is bound to the request context creating them
while the timer callback is detached from the creating request's
context (by design) and runs in its own (fake) request context. If you
try to share the thread or cosocket objects across the boundary of the
creating request, then you will get the "no co ctx found" error (for
threads) or "bad request" (for cosockets). It is fine, however, to
creating all these objects inside your timer callback."
Best regards,
-agentzh