Commit c89e3a3
authored
feat: rateLimit() replace raw Map with TTLCache to remove manual cleanup logic [ GSSOC'26 ] (JhaSourav07#1137)
## Description
Fixes JhaSourav07#1135
The `rateLimit()` function used a raw `Map` with manual periodic
cleanup to handle expiry and capacity. `TTLCache` is already imported
in the same file and handles both automatically. This PR replaces the
raw Map with a `TTLCache` instance, removing ~15 lines of manual
cleanup logic and making the implementation consistent with the
existing `RateLimiter` class.
## 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: 7 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
49 | 49 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 50 | | |
59 | 51 | | |
60 | 52 | | |
| |||
63 | 55 | | |
64 | 56 | | |
65 | 57 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 58 | + | |
| 59 | + | |
83 | 60 | | |
84 | 61 | | |
85 | 62 | | |
86 | 63 | | |
87 | | - | |
| 64 | + | |
88 | 65 | | |
89 | 66 | | |
90 | 67 | | |
91 | 68 | | |
| 69 | + | |
92 | 70 | | |
93 | 71 | | |
94 | 72 | | |
95 | 73 | | |
96 | 74 | | |
97 | 75 | | |
98 | | - | |
| 76 | + | |
99 | 77 | | |
100 | 78 | | |
101 | 79 | | |
102 | 80 | | |
103 | 81 | | |
104 | 82 | | |
105 | 83 | | |
106 | | - | |
| 84 | + | |
107 | 85 | | |
108 | 86 | | |
0 commit comments