membphis commented on code in PR #14244: URL: https://github.com/apache/apisix/pull/14244#discussion_r4661547862
########## apisix/utils/limit.lua: ########## @@ -0,0 +1,146 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +local core = require("apisix.core") +local jsonpath = require("jsonpath") +local ipairs = ipairs +local type = type +local rawget = rawget +local getmetatable = getmetatable +local setmetatable = setmetatable +local tostring = tostring +local crc32 = ngx.crc32_long +local parsed_paths = {} + +local _M = {} + +-- Connection credentials and tuning do not identify the counter's storage. +-- Keep this list shared by the three plugins instead of ignoring redis_*. +local backend_paths = { Review Comment: These definitions should not be here; they belong to each plugin. The core library should not be coupled to plugin-specific behavior. ########## apisix/plugins/limit-count/delayed-syncer.lua: ########## @@ -206,6 +211,22 @@ function _M._delayed_sync(self, key, cost, syncer_id) end remote_remaining, remote_reset, sync_at = quota.remaining, quota.reset, quota.sync_at + local rebase = quota.limit and quota.limit ~= self.limit + if rebase then Review Comment: Was the logic inside this `if` added to fix a pre-existing bug uncovered during this work, or a problem introduced by the changes in this PR? If it is the former, please fix it in a separate PR rather than mixing it into this one. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
