We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/moonbingbing/openresty-best-practices/blob/master/ngx_lua/lua-variable-scope.md
在这一节里,提到:
init_worker_by_lua_block { local delay = 5 local handler handler = function() counter = counter or 0 counter = counter + 1 ngx.log(ngx.ERR, counter) local ok, err = ngx.timer.at(delay, handler) if not ok then ngx.log(ngx.ERR, "failed to create the timer: ", err) return end end local ok, err = ngx.timer.at(delay, handler) if not ok then ngx.log(ngx.ERR, "failed to create the timer: ", err) return end }
每次 counter 的输出都是 1。
然后实际的情况是,确实每次 timer 执行都在累加,而并没有重新定义。应该需要更新一下文档。
@membphis
The text was updated successfully, but these errors were encountered:
欢迎 PR ^_^
Sorry, something went wrong.
No branches or pull requests
https://github.com/moonbingbing/openresty-best-practices/blob/master/ngx_lua/lua-variable-scope.md
在这一节里,提到:
每次 counter 的输出都是 1。
然后实际的情况是,确实每次 timer 执行都在累加,而并没有重新定义。应该需要更新一下文档。
@membphis
The text was updated successfully, but these errors were encountered: