Hello!
2013/1/13 chencpp:
> 请教一个ngx_lua的问题
> ngx.location.capture_multi需要等最慢的请求返回,我不想这样
> 假如4个子请求, 我想要的逻辑是,假如第3个子请求先回来,do_some_thing, 假如第2个先回来,do_other_thing。
> 想问可以在lua协程中调用ngx.location.capture来完成我要的功能吗?
你可以使用 ngx.thread API + ngx.location.capture 来实现这种先到先处理的模型。细节可以参见
ngx_lua 的“轻量级线程” API 的文档:
http://wiki.nginx.org/HttpLuaModule#ngx.thread.spawn
同时抄送给 openresty 中文邮件列表:http://openresty.org/#Community
希望你也能加入此列表并在那里交流这样的技术问题,谢谢合作 :)
Best regards,
-agentzh