Hello!
On Thu, Sep 1, 2016 at 8:00 PM, Peng Liu wrote:
> Thanks. At present I implement it in rewrite_by_lua block. Which method is
> more efficient?
>
ngx.timer.at() is asynchronous, which means that you cannot easily get
the result of your timer handler in the Lua handler (balancer_by_lua*)
creating the timer.
Using an earlier phase handlers like rewrite_by_lua* and
access_by_lua* is the right way to go, which is also documented
officially. You can pass the result easily to balancer_by_lua* via the
ngx.ctx API, for example. This is the recommended approach.
Regards,
-agentzh