Hello!
> if not found then
> table.insert(user["dev_list"], dev_id)
我没看到这个 user 变量是在什么地方定义的。
值得一提的是,你提供的这个例子并不是完整的(比如我无法在我本地运行,如果我不自己靠猜测进行补全的话),貌似也没有最小化。
> 如上代码所示,同时推送三个ID,23,24,25,根据返回结果看,table.insert(...)已经正确执行,但是在获取dev_list的时候,最终结果,25被24覆盖了。
我猜你这里滥用了 Lua 全局变量,每个请求都有自己的一套全局变量。请参见下面的文档:
https://github.com/openresty/lua-nginx-module#lua-variable-scope
还有这个:
https://github.com/openresty/lua-nginx-module#data-sharing-within-an-nginx-worker
Regards,
-agentzh
--
--
邮件来自列表“openresty”,专用于技术讨论!
订阅: 请发空白邮件到 openresty+subscribe@googlegroups.com
发言: 请发邮件到 openresty@googlegroups.com
退订: 请发邮件至 openresty+unsubscribe@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