Comments (2)
Without using the RedisStorage, the module throws an exception after 30 requests, as you've set.
I used this zsh script to test it
throttlerTest() {
dummy=count
count=0
while true
do
curl -s --fail http://localhost:3000/app/hello
if [ $? -ne 0 ]
then
echo "We got rate limited"
curl -v http://localhost:3000/app/hello
break
fi
(($dummy += 1))
done
echo "Requests made before limiting:"
echo $count
}
And got back
❯ throttlerTest
Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!Hello World!We got rate limited
* Trying ::1:3000...
* TCP_NODELAY set
* Connected to localhost (::1) port 3000 (#0)
> GET /app/hello HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/7.68.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 429 Too Many Requests
< X-Powered-By: Express
< Retry-After: 60
< Content-Type: application/json; charset=utf-8
< Content-Length: 68
< ETag: W/"44-McWaoNlzt3iglN2odEGCDEADErE"
< Date: Wed, 24 Mar 2021 04:05:14 GMT
< Connection: keep-alive
< Keep-Alive: timeout=5
<
* Connection #0 to host localhost left intact
{"statusCode":429,"message":"ThrottlerException: Too Many Requests"}Requests made before limiting:
30
So like you said, it works normally, meaning there's a problem with how the sub-library works and returns the ttls
that are used in this line for the header calculation
from throttler.
Fixed in kkoomen/nestjs-throttler-storage-redis v0.1.12.
from throttler.
Related Issues (20)
- Is throttler limits number of request per user or on total count HOT 5
- Requesting flooding bypasses throttle limit HOT 2
- throttler will add more times in a request HOT 6
- Add a way to use Throttler multiple times HOT 1
- Using throttler with graphql causes: `TypeError: Cannot read properties of undefined (reading 'header')` HOT 5
- Context-based `ttl` and `limit` options HOT 7
- Support for async `getTracker`
- this library does not support Nestjs 10.0.0 HOT 3
- 4.2.0 is a BREAKING CHANGE for custom guards HOT 2
- Advanced Rate Limiting Options for Throttler
- Share same context between 'limit' and 'ttl' HOT 4
- Revert ttl when request failed HOT 1
- Throttle only on Unauthorized requests HOT 2
- Block duration option for throttler HOT 4
- No way to create custom key generator for storage HOT 3
- Docs on WS guard is not updated HOT 2
- SkipThrottle decorator no longer working HOT 5
- `this` is undefined in custom guard extending the ThrottlerGuard when overriding `generateKey` method HOT 2
- Quota-based throttling
- Throttle on only a single route HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from throttler.