File tree Expand file tree Collapse file tree
gateway/src/apicast/policy/routing Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,16 @@ function _M.new(config)
3737 return self
3838end
3939
40+ local function route_upstream_usage_cleanup (self , usage , matched_rules )
41+ if not self .route_upstream then
42+ return
43+ end
44+
45+ local usage_diff = mapping_rules_matcher .clean_usage_by_owner_id (
46+ matched_rules , self .route_upstream :has_owner_id ())
47+ usage :merge (usage_diff )
48+ end
49+
4050function _M :access (context )
4151 -- All route definition needs to happen in the access phase to make sure that
4252 -- the mapping rule with the owner_id happens before the APIcast policy and
@@ -57,16 +67,7 @@ function _M:access(context)
5767
5868 -- this function substract the usage that does not match with the owner_id by
5969 -- the matched_rules
60- context .route_upstream_usage_cleanup = function (self , usage , matched_rules )
61- if not self .route_upstream then
62- return
63- end
64-
65- local usage_diff = mapping_rules_matcher .clean_usage_by_owner_id (
66- matched_rules , self .route_upstream :has_owner_id ())
67- usage :merge (usage_diff )
68- end
69-
70+ context .route_upstream_usage_cleanup = route_upstream_usage_cleanup
7071end
7172
7273
You can’t perform that action at this time.
0 commit comments