From fd0bda7547d2c8848cba97435b83d6fddf838a79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Mon, 10 Feb 2025 13:25:41 +0100 Subject: [PATCH] feat: add dynamic expire --- .../src/throttler-storage-redis.service.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/throttler-storage-redis/src/throttler-storage-redis.service.ts b/packages/throttler-storage-redis/src/throttler-storage-redis.service.ts index 8750d56..c1dccca 100644 --- a/packages/throttler-storage-redis/src/throttler-storage-redis.service.ts +++ b/packages/throttler-storage-redis/src/throttler-storage-redis.service.ts @@ -46,6 +46,10 @@ export class ThrottlerStorageRedisService implements ThrottlerStorageRedis, OnMo timeToExpire = ttl end + if blockDuration < 0 then + blockDuration = timeToExpire + end + local isBlocked = redis.call('GET', blockKey) local timeToBlockExpire = 0