Skip to content

Commit

Permalink
fix: etcd data sync exception (#8493)
Browse files Browse the repository at this point in the history
Co-authored-by: 80317381 <zhengwei@oppo.com>
  • Loading branch information
jobop and CuttleFishMan authored Mar 21, 2023
1 parent 8e9c051 commit 3b76c45
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apisix/core/config_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ end

-- fire all clean handlers added by add_clean_handler.
function _M.fire_all_clean_handlers(item)
-- When the key is deleted, the item will be set to false.
if not item then
return
end
if not item.clean_handlers then
return
end
Expand Down
8 changes: 8 additions & 0 deletions t/core/config_util.t
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ __DATA__
return item, idx1, idx2
end
local function setup_to_false()
local item = false
return item
end
local item, idx1, idx2 = setup()
util.cancel_clean_handler(item, idx1, true)
util.cancel_clean_handler(item, idx2, true)
Expand All @@ -103,6 +108,9 @@ __DATA__
local item, idx1, idx2 = setup()
util.cancel_clean_handler(item, idx1)
util.fire_all_clean_handlers(item)
local item = setup_to_false()
util.fire_all_clean_handlers(item)
}
}
--- grep_error_log eval
Expand Down

0 comments on commit 3b76c45

Please sign in to comment.