diff --git a/kong/router/atc.lua b/kong/router/atc.lua index 487d63b62a2c..967ad9bd8f88 100644 --- a/kong/router/atc.lua +++ b/kong/router/atc.lua @@ -181,7 +181,9 @@ local function new_from_scratch(routes, get_exp_and_priority) local new_updated_at = 0 - for _, r in ipairs(routes) do + for i = 1, routes_n do + local r = routes[i] + local route = r.route local route_id = route.id @@ -240,7 +242,9 @@ local function new_from_previous(routes, get_exp_and_priority, old_router) local new_updated_at = 0 -- create or update routes - for _, r in ipairs(routes) do + for i = 1, #routes do + local r = routes[i] + local route = r.route local route_id = route.id diff --git a/kong/router/utils.lua b/kong/router/utils.lua index 3721feb8e5f5..0aa9a4b0f047 100644 --- a/kong/router/utils.lua +++ b/kong/router/utils.lua @@ -292,8 +292,8 @@ do local v0 = 0 local v1 = 0 - for _, route in ipairs(routes) do - local r = route.route + for i = 1, #routes do + local r = routes[i].route local paths_t = r.paths or empty_table local headers_t = r.headers or empty_table