New issue
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
resty-lock inoperative in init_worker_by_lua_file #18
Comments
@panjunDev This is a known limitation. See https://github.com/openresty/lua-resty-lock/#limitations |
hi, agentzh |
@fengshenyun Sounds like you should really load the data in the |
because of i need load data from a http server, init_by_lua* is not allow do this. |
@fengshenyun You can try using the blocking LuaSocket library to do this as long as its timeout protection is good enough. It does not matter to block in the master process for a bit (just not too long). But yeah, we'll eventually enable the cosocket API in the context of |
hi,agentzh
I used lock:lock on init_worker_by_lua_file,but inoperative.
here is my code
`local resty_lock = require "resty.lock"
local lockOpts = {["exptime"]="5",["timeout"]="0"}
local lock, err = resty_lock:new("MY_LOCKS",lockOpts)
if not lock then
ngx.log(ngx.ERR,"failed to create lock:"..tostring(err))
return
end
local elapsed, err = lock:lock('lock_key')
if not elapsed then
ngx.log(ngx.DEBUG,"failed to acquire the lock: "..tostring(err))
return
else
ngx.log(ngx.DEBUG,"get lock success")
return
end
)`
My nginx has 4 workers and i set timeout=0 for get lock operation,but still display 4 'get lock success'
The text was updated successfully, but these errors were encountered: