resty/http.lua:100: API disabled in the context of init_worker_by_lua*
stack traceback:
[C]: in function 'ngx_socket_tcp'
lualib/resty/http.lua:100: in function 'new'
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
归档: http://groups.google.com/group/openresty
官网: http://openresty.org/
仓库: https://github.com/agentzh/ngx_openresty
教程: http://openresty.org/download/agentzh-nginx-tutorials-zhcn.html
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty+subscribe@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+unsubscribe@googlegroups.com
Hello正确的做法是:在 init_worker 创建 timer,在 timer 内使用 cosocket
在 2016年12月2日 下午1:26,Huabin Zheng <huabin...@gmail.com>写道:
我用resty.http在init_worker_by_lua中执行这个while loop,结果报错说resty/http.lua:100: API disabled in the context of init_worker_by_lua*
stack traceback:
[C]: in function 'ngx_socket_tcp'
lualib/resty/http.lua:100: in function 'new'
On Thursday, December 1, 2016 at 1:05:17 PM UTC+8, Huabin Zheng wrote:想用lua实现发送http请求watch consul上的服务注册信息,当注册信息有变化时watcher返回,使用根据最新的注册信息更新nginx upstream。伪代码表示如下:while true:r = send_http_request(url)# block until registry changednew_upstream = build_upstream(r)replace_upstream(new_upstream)
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty...@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+...@googlegroups.com
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty+subscribe@googlegroups.com
发言: 请发邮件到 open...@googlegroups.com
退订: 请发邮件至 openresty+unsubscribe@googlegroups.com