Skip to content

Commit

Permalink
merge #9343
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Sep 8, 2022
1 parent 074a8b4 commit d6afe13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 758 deletions.
8 changes: 8 additions & 0 deletions kong/router/atc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,18 @@ local function new_from_scratch(routes, get_exp_priority)
fields = fields,
match_headers = match_headers,
updated_at = new_updated_at,
rebuilding = false,
}, _MT)
end


local function new_from_previous(routes, get_exp_priority, old_router)
if old_router.rebuilding then
return nil, "concurrent incremental router rebuild without mutex, this is unsafe"
end

old_router.rebuilding = true

local inst = old_router.router
local old_routes = old_router.routes
local old_services = old_router.services
Expand Down Expand Up @@ -237,6 +244,7 @@ local function new_from_previous(routes, get_exp_priority, old_router)
old_router.fields = fields
old_router.match_headers = has_header_matching_field(fields)
old_router.updated_at = new_updated_at
old_router.rebuilding = false

return old_router
end
Expand Down
Loading

0 comments on commit d6afe13

Please sign in to comment.