Hi there,
I am looking to do insert opt in ngx.timer.at or ngx.timer.every to do some cron job.It cause a runtime error:API disabled in the current context.
stack traceback:
[C]: in function '__index'
.//lua/vendor/resty/moongoo/utils.lua:31: in function 'generate_oid'
.//lua/vendor/resty/moongoo/collection.lua:67: in function 'ensure_oids'
After reading the openresty manual,the ngx.var.pid cannot be used in context(ngx.timer.*),so i use ngx.woker.pid() to relpace ngx.var.pid.It works well in openresty 1.11.x.
Hi there, I am looking to do insert opt in ngx.timer.at or ngx.timer.every to do some cron job.It cause a runtime error:API disabled in the current context. stack traceback: [C]: in function '__index' .//lua/vendor/resty/moongoo/utils.lua:31: in function 'generate_oid' .//lua/vendor/resty/moongoo/collection.lua:67: in function 'ensure_oids' After reading the openresty manual,the ngx.var.pid cannot be used in context(ngx.timer.*),so i use ngx.woker.pid() to relpace ngx.var.pid.It works well in openresty 1.11.x.
https://github.com/openresty/lua-nginx-module#ngxwokerpid https://github.com/openresty/lua-nginx-module#ngxvarvariable