Commit 8c1dae0
authored
feat: add reset() method to clear rate limit state for a given IP [ GSSOC '26 ] (JhaSourav07#1168)
## Description
Fixes JhaSourav07#1165
Adds a `reset(ip)` method to `RateLimiter` that clears the request
count for a given IP by calling `cache.delete(ip)`. This allows
rate limit state to be cleared immediately after a successful
authentication or admin action, without waiting for TTL expiry.
Depends on the `delete()` method added to `TTLCache` in the previous
contribution.
## Pillar
- [x] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
N/A — internal rate limiting logic, no visual output.
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally.
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors.
- [x] My commits follow the Conventional Commits format.
- [x] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] I have starred the repo.
- [x] I have made sure that I have only one commit to merge in this PR.
- [ ] The SVG output matches the CommitPulse "premium quality" aesthetic
standard.
- [ ] (Recommended) I joined the CommitPulse Discord community.1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
49 | 63 | | |
50 | 64 | | |
51 | 65 | | |
| |||
0 commit comments