hi,
There is no shutdown-hook in OpenResty, but you can try like this:
init_worker_by_lua_file worker.lua
worker.lua
-----------------
local handler
local delay = 5
handle = function (premature)
if ngx.worker.exiting() then
--- cleanup()
return
end
if not ok then
ngx.log(ngx.ERR, "failed to create timer: ", err)
end
end
if not ok then
ngx.log(ngx.ERR, "failed to create timer: ", err)
end