Commit 5790627
authored
feat: add getRemainingRequests and getResetTime methods [ GSSOC'26 ] (JhaSourav07#1189)
feat(rate-limiter): add getRemainingRequests and getResetTime methods
Fixes JhaSourav07#1188
## Description
Added two new read-only methods to the `RateLimiter` class —
`getRemainingRequests()`
and `getResetTime()` — so API responses can include standard
`X-RateLimit-*` headers.
Also exposed `getExpiry()` on `TTLCache` to support the reset time
lookup.
Pillar:
[x]🛠️ Other (Bug fix, refactoring, docs)
Visual Preview: N/A — internal utility methods, no visual output.
Checklist:
- [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 starred the repo.
- [x] I have made sure that I have only one commit to merge in this PR.1 file changed
Lines changed: 28 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
3 | 10 | | |
4 | 11 | | |
5 | 12 | | |
| |||
46 | 53 | | |
47 | 54 | | |
48 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
49 | 77 | | |
50 | 78 | | |
51 | 79 | | |
| |||
72 | 100 | | |
73 | 101 | | |
74 | 102 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | 103 | | |
83 | 104 | | |
84 | 105 | | |
| |||
0 commit comments