core - do not execute init() if BW is in loading state
This commit is contained in:
parent
00b50c1629
commit
0fdb108fe9
|
@ -27,6 +27,12 @@ function plugin:initialize(id)
|
|||
end
|
||||
self.variables[k] = value
|
||||
end
|
||||
-- Is loading
|
||||
local is_loading, err = utils.get_variable("IS_LOADING", false)
|
||||
if is_loading == nil then
|
||||
self.logger:log(ngx.ERR, "can't get IS_LOADING variable : " .. err)
|
||||
end
|
||||
self.is_loading = is_loading == "yes"
|
||||
end
|
||||
|
||||
function plugin:get_id()
|
||||
|
|
|
@ -36,7 +36,7 @@ function blacklist:init()
|
|||
if init_needed == nil then
|
||||
return self:ret(false, "can't check USE_BLACKLIST variable : " .. err)
|
||||
end
|
||||
if not init_needed then
|
||||
if not init_needed or self.is_loading then
|
||||
return self:ret(true, "init not needed")
|
||||
end
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function bunkernet:init()
|
|||
if init_needed == nil then
|
||||
return self:ret(false, "can't check USE_BUNKERNET variable : " .. err)
|
||||
end
|
||||
if not init_needed then
|
||||
if not init_needed or self.is_loading then
|
||||
return self:ret(true, "no service uses bunkernet, skipping init")
|
||||
end
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ function greylist:init()
|
|||
if init_needed == nil then
|
||||
return self:ret(false, "can't check USE_GREYLIST variable : " .. err)
|
||||
end
|
||||
if not init_needed then
|
||||
if not init_needed or self.is_loading then
|
||||
return self:ret(true, "init not needed")
|
||||
end
|
||||
-- Read greylists
|
||||
|
|
|
@ -48,7 +48,7 @@ function limit:init()
|
|||
if init_needed == nil then
|
||||
return self:ret(false, err)
|
||||
end
|
||||
if not init_needed then
|
||||
if not init_needed or self.is_loading then
|
||||
return self:ret(true, "no service uses Limit for requests, skipping init")
|
||||
end
|
||||
-- Get variables
|
||||
|
|
|
@ -13,8 +13,8 @@ end
|
|||
|
||||
function redis:init()
|
||||
-- Check if init is needed
|
||||
if self.variables["USE_REDIS"] then
|
||||
return self:ret(true, "redis not used")
|
||||
if self.variables["USE_REDIS"] ~= "yes" or self.is_loading then
|
||||
return self:ret(true, "init not needed")
|
||||
end
|
||||
-- Check redis connection
|
||||
local ok, err = clusterstore:connect()
|
||||
|
|
|
@ -11,6 +11,9 @@ function sessions:initialize()
|
|||
end
|
||||
|
||||
function sessions:init()
|
||||
if self.is_loading then
|
||||
return self:ret(true, "init not needed")
|
||||
end
|
||||
-- Get redis vars
|
||||
local redis_vars = {
|
||||
["USE_REDIS"] = "",
|
||||
|
|
|
@ -37,7 +37,7 @@ function whitelist:init()
|
|||
if init_needed == nil then
|
||||
return self:ret(false, "can't check USE_WHITELIST variable : " .. err)
|
||||
end
|
||||
if not init_needed then
|
||||
if not init_needed or self.is_loading then
|
||||
return self:ret(true, "init not needed")
|
||||
end
|
||||
-- Read whitelists
|
||||
|
|
Loading…
Reference in New Issue