diff options
| author | Factiven <[email protected]> | 2023-10-28 22:50:51 +0700 |
|---|---|---|
| committer | Factiven <[email protected]> | 2023-10-28 22:50:51 +0700 |
| commit | a25282429761ff0670a50fd74f8c24bdb38e728c (patch) | |
| tree | 0cd14840e665f1912842967de7427a31556190e6 /lib/redis.js | |
| parent | Update v4.2.3 (diff) | |
| download | moopa-a25282429761ff0670a50fd74f8c24bdb38e728c.tar.xz moopa-a25282429761ff0670a50fd74f8c24bdb38e728c.zip | |
Update v4.2.4
Diffstat (limited to 'lib/redis.js')
| -rw-r--r-- | lib/redis.js | 13 |
1 files changed, 12 insertions, 1 deletions
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 }; |