From a25282429761ff0670a50fd74f8c24bdb38e728c Mon Sep 17 00:00:00 2001 From: Factiven Date: Sat, 28 Oct 2023 22:50:51 +0700 Subject: Update v4.2.4 --- lib/redis.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/redis.js b/lib/redis.js index 713b5d9..9522e4c 100644 --- a/lib/redis.js +++ b/lib/redis.js @@ -6,6 +6,7 @@ const REDIS_URL = process.env.REDIS_URL; let redis; let rateLimiterRedis; let rateLimitStrict; +let rateSuperStrict; if (REDIS_URL) { redis = new Redis(REDIS_URL); @@ -27,10 +28,20 @@ if (REDIS_URL) { duration: 1, }; + const optSuperStrict = { + storeClient: redis, + keyPrefix: "rateLimitSuperStrict", + points: 3, + // duration 10 minutes + duration: 10 * 60, + blockDuration: 10 * 60, + }; + rateLimiterRedis = new RateLimiterRedis(opt); rateLimitStrict = new RateLimiterRedis(optStrict); + rateSuperStrict = new RateLimiterRedis(optSuperStrict); } else { console.warn("REDIS_URL is not defined. Redis caching will be disabled."); } -export { redis, rateLimiterRedis, rateLimitStrict }; +export { redis, rateLimiterRedis, rateLimitStrict, rateSuperStrict }; -- cgit v1.2.3