Skip to content

Commit 5dd3914

Browse files
committed
perf: reuse PolicyOrderChecker
1 parent 5f7dbc1 commit 5dd3914

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

gateway/src/apicast/policy_chain.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,15 @@ function _M:add_policy(name, version, ...)
193193
end
194194
end
195195

196+
local default_policy_order_check = PolicyOrderChecker.new(policy_manifests_loader.get_all())
197+
196198
-- Checks if there are any policies placed in the wrong place in the chain.
197199
-- It doesn't return anything, it prints error messages when there's a problem.
198200
function _M:check_order(manifests)
199-
PolicyOrderChecker.new(
200-
manifests or policy_manifests_loader.get_all()
201-
):check(self)
201+
if manifests then
202+
PolicyOrderChecker.new(manifests):check(self)
203+
end
204+
default_policy_order_check:check(self)
202205
end
203206

204207
local function call_chain(phase_name)

0 commit comments

Comments
 (0)