Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rate-limiting): revert request-aware-table usage #11746

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 19 additions & 22 deletions kong/plugins/rate-limiting/policies/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local policy_cluster = require "kong.plugins.rate-limiting.policies.cluster"
local timestamp = require "kong.tools.timestamp"
local reports = require "kong.reports"
local redis = require "resty.redis"
local request_aware_table = require "kong.tools.request_aware_table"
local table_clear = require "table.clear"

local kong = kong
local pairs = pairs
Expand All @@ -18,26 +18,23 @@ local EMPTY_UUID = "00000000-0000-0000-0000-000000000000"
-- for `conf.sync_rate > 0`
local auto_sync_timer

local cur_usage = request_aware_table.new()
-- {
-- [[
-- [cache_key] = <integer>
-- ]]
-- }
local cur_usage = {
--[[
[cache_key] = <integer>
--]]
}

local cur_usage_expire_at = request_aware_table.new()
-- {
-- [[
-- [cache_key] = <integer>
-- ]]
-- }
local cur_usage_expire_at = {
--[[
[cache_key] = <integer>
--]]
}

local cur_delta = request_aware_table.new()
-- {
-- [[
-- [cache_key] = <integer>
-- ]]
-- }
local cur_delta = {
--[[
[cache_key] = <integer>
--]]
}


local function is_present(str)
Expand Down Expand Up @@ -141,9 +138,9 @@ local function get_redis_connection(conf)
end

local function clear_local_counter()
cur_usage:clear()
cur_usage_expire_at:clear()
cur_delta:clear()
table_clear(cur_usage)
table_clear(cur_usage_expire_at)
table_clear(cur_delta)
end

local function sync_to_redis(premature, conf)
Expand Down
Loading