Skip to content

Commit 74bd8d2

Browse files
committed
f
1 parent 3317748 commit 74bd8d2

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/api/apiUtils/rateLimit/client.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ class RateLimitClient {
6767
}
6868
}
6969

70-
let counterClient;
70+
let instance;
7171
if (config.rateLimiting.enabled) {
7272
counterClient = new RateLimitClient(config.localCache);
7373
}
7474

7575
module.exports = {
76-
counterClient,
76+
instance,
7777
RateLimitClient
7878
};

lib/api/apiUtils/rateLimit/updateCounter.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
-- updateCounter <KEY> <COST>
2+
--
3+
-- Adds the passed COST to the GCRA counter at KEY.
4+
-- If no counter currently exists a new one is created from the current time.
5+
-- The key expiration is set to the updated value.
6+
-- Returns the value of the updated key.
7+
18
local ts = redis.call('TIME')
29
local currentTime = ts[1] * 1000
310
currentTime = currentTime + math.floor(ts[2] / 1000)

0 commit comments

Comments
 (0)