Merge pull request #1570 from SkynetLabs/fix-empty-blocklist-error

check if blocklist is not null
This commit is contained in:
Christopher Schinnerl 2022-01-20 10:55:41 +00:00 committed by GitHub
commit c17998ee23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -26,9 +26,12 @@ function _M.reload()
-- mark all existing entries as expired
ngx.shared.blocklist:flush_all()
-- set all cache entries one by one (resets expiration)
for i, hash in ipairs(data.blocklist) do
ngx.shared.blocklist:set(hash, true)
-- 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)
for i, hash in ipairs(data.blocklist) do
ngx.shared.blocklist:set(hash, true)
end
end
-- ensure that init flag is persisted