Points not decreasing
See original GitHub issueI’m using nore-rate-limiter-flexible
via example memory code within my stack to check specific requests, but the remaining points are never decreasing. (even if I spam multiple per second)
Code:
const rate = new RateLimiterMemory({points: 5, duration: 1})
rate
.consume(req.ip, 2)
.then((e) => {
console.log('ip', req.ip)
console.log('response', e)
})
.catch(() => {
console.error('rate limit')
})
Response:
ip: ::1
response: {
remainingPoints: 3,
msBeforeNext: 1000,
consumedPoints: 2,
isFirstInDuration: true
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
About point reduction - New York DMV
Point reduction does not prevent or cancel a mandatory revocation or suspension for violations such as DWI, DWAI, or three speeding violations within...
Read more >Visual glitch? Summoning points not draining : r/runescape
It seems that the summoning points bar is all messed up atm. ... Restore over time, replenished by Summoning Pots, cost reduced by...
Read more >Points and Points Reduction | Georgia Department of Driver ...
Offense Code Conviction Points
§40‑6‑397 Aggressive Driving 6 Points
§40‑6‑390 Reckless Driving 4 Points
§40‑6‑163 Unlawful Passing School Bus 6 Points
Read more >Mortgage Points: What are they and how do they work?
Mortgage points are basically a way to lower your mortgage's interest rate — for a fee. Here's how they work and when to...
Read more >What Are Points in the Stock Market? - Investopedia
Points refer only to the dollar amount that has changed, not the percentage. Two stocks can lose the same number of points but...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Okay, I think I got the problem. I recreated the RateLimiter every request to be able to set dynamic options, which resets the memory. I’m setting different versions now once on startup. Thanks for the help!
Hi, I am also facing the same issue when we are trying to use memory code instead of the share memory (redis/memcached) points are not getting decreased even when I am hitting a particular endpoint multiple times using ab testing .
@tre-dev what do you meant when you said -> “I recreated the RateLimiter every request to be able to set dynamic options, which resets the memory. I’m setting different versions now once on startup”
what changes will I have to make ?
I am always getting this in response { remainingPoints: 50, msBeforeNext: 1000, consumedPoints: 50, isFirstInDuration: true }
so basically its treating all the requests as first requests (isFirstInDuration is always true) and never decreasing points after first time.