check if blocklist is not null
This commit is contained in:
parent
39f04bba06
commit
ce3b3d035d
|
@ -26,10 +26,13 @@ function _M.reload()
|
||||||
-- mark all existing entries as expired
|
-- mark all existing entries as expired
|
||||||
ngx.shared.blocklist:flush_all()
|
ngx.shared.blocklist:flush_all()
|
||||||
|
|
||||||
|
-- check if blocklist is table (it is null when empty)
|
||||||
|
if type(data.blocklist) == "table" then
|
||||||
-- set all cache entries one by one (resets expiration)
|
-- set all cache entries one by one (resets expiration)
|
||||||
for i, hash in ipairs(data.blocklist) do
|
for i, hash in ipairs(data.blocklist) do
|
||||||
ngx.shared.blocklist:set(hash, true)
|
ngx.shared.blocklist:set(hash, true)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- ensure that init flag is persisted
|
-- ensure that init flag is persisted
|
||||||
ngx.shared.blocklist:set("__init", true)
|
ngx.shared.blocklist:set("__init", true)
|
||||||
|
|
Reference in New Issue