isage / lua-resty-moongoo

MongoDB library for OpenResty
Do What The F*ck You Want To Public License
118 stars 33 forks source link

Unable to use insert opt in ngx.timer.at or ngx.timer.every #22

Closed QuanZag closed 6 years ago

QuanZag commented 6 years ago

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

QuanZag commented 6 years ago

It is fixed by @jetz 14 days ago,I miss it.