nic-6443 commented on code in PR #12751: URL: https://github.com/apache/apisix/pull/12751#discussion_r2548289377
########## apisix/plugins/limit-count/limit-count-redis-cluster.lua: ########## @@ -57,26 +47,33 @@ function _M.new(plugin_name, limit, window, conf) end -function _M.incoming(self, key, cost) - local red = self.red_cli - local limit = self.limit - local window = self.window - key = self.plugin_name .. tostring(key) +function _M.incoming(self, key, cost, dry_run) + local commit = true + if dry_run ~= nil then + commit = not dry_run + end - local ttl = 0 - local res, err = red:eval(script, 1, key, limit, window, cost or 1) + return util.redis_incoming(self, self.red_cli, key, commit, cost) Review Comment: Can we directly check `ngx.phase` here? This way, the APIs of `limit-count-redis-cluster.lua` and `limit-count-redis.lua` do not need to be changed, still only providing an `incoming` function without introducing a new `log_phase_incoming`. -- 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]
