-
Notifications
You must be signed in to change notification settings - Fork 762
runtimeset 操作时,会删除原策略,再设置新策略,如果后续报错policy NO 不存在,会导致原策略设置的规则被删。建议删除放在判断之后。 #100
Copy link
Copy link
Open
Description
文件:admin/runtime.lua 186行
local pfunc = function()
local runtimeGroupMod = runtimeGroupModule:new(database, runtimeLib)
return runtimeGroupMod:del(hostname)
end
local status, info = xpcall(pfunc, handler)
if not status then
local response = doerror(info)
ngx.say(response)
return false
end
local pfunc = function()
local policyMod = policyModule:new(database, policyLib)
local policy = policyMod:get(policyId)
local divtype = policy.divtype
local divdata = policy.divdata
if divtype == ngx.null or divdata == ngx.null then
error{ERRORINFO.POLICY_BLANK_ERROR, 'policy NO '..policyId}
end
if not divtypes[divtype] then
end
local prefix = hostname .. ':first'
local divModulename = table.concat({'abtesting', 'diversion', divtype}, '.')
local divDataKey = table.concat({policyLib, policyId, fields.divdata}, ':')
local userInfoModulename = table.concat({'abtesting', 'userinfo', divtypes[divtype]}, '.')
local runtimeMod = runtimeModule:new(database, runtimeLib)
runtimeMod:set(prefix, divModulename, divDataKey, userInfoModulename)
local divSteps = runtimeLib .. ':' .. hostname .. ':' .. fields.divsteps
local ok, err = database:set(divSteps, 1)
if not ok then error{ERRORINFO.REDIS_ERROR, err} end
end
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels