We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 35fb17e commit 74b5299Copy full SHA for 74b5299
1 file changed
lib/rate-limit.ts
@@ -46,6 +46,20 @@ export class RateLimiter {
46
this.cache.set(ip, current + 1, this.windowMs);
47
return true;
48
}
49
+ /**
50
+ * Resets the request count for a given IP address.
51
+ *
52
+ * Useful for clearing rate limit state after a successful
53
+ * authentication or admin action.
54
55
+ * @param ip - The IP address to reset.
56
57
+ * @example
58
+ * rateLimiter.reset("192.168.1.1");
59
+ */
60
+ reset(ip: string): void {
61
+ this.cache.delete(ip);
62
+ }
63
64
65
// Global instance for track-user endpoint (5 requests per IP per minute)
0 commit comments