Releases: animir/node-rate-limiter-flexible
AI docs fix
Full Changelog: v10.0.0...v10.0.1
Require points and duration opts
What's Changed
[BREAKING CHANGES]
-
Require
pointsanddurationoptions by @animir in #354No default values are set for
pointsanddurationoptions starting from v10. Negativepointswill not be replaced by default points value4.
Validation rules apply.Error is thrown during limiter creation if points or duration is invalid:
-
pointsmust be number.Any limiter accepts negative
pointsas valid option starting from v10. If you migrate from older version, be careful: If in your codepointsoption is set to negative value and that works for your project now then you should review the logic in your project. After update to version 10, negativepointsvalue will not be replaced by4by default as it was prior to version 10.When your limiter has negative or zero points
consumemethod call is always rejected since there is always not enough points to consume. You can setpointsto negative and play withrewardandconsumecalls, that could be useful sometimes. -
durationmust be non-negative number>= 0. Error is thrown during limiter creation ifdurationoption has invalid value.
Requiring
pointsanddurationseems logical for security package. We don't want our apps working not as we expect even if there is no security threat. This update removes uncertaincy about negative duration and zero points. -
[OTHER UPDATES]
-
Faster memory limiter and block mechanism by @animir in #355
Internal memory storage implementation refactored for Map with timestamps instead of Date objects.
Memory limiter is faster on 10-15% now on high traffic with diverse keys. Tests show performance improvement from
2569948 ops/secto2885688 ops/secon my laptop.
Full Changelog: v9.1.1...v10.0.0
🐚
Sequelize v7 support
Non atomic Redis limiter
Fixes: Queue and DynamoDB
What's Changed
- RateLimiterQueue: maxQueueSize default param when opts is set to
{}by @sevauni in #340 - RateLimiterDynamo: return null for expired keys in get() method by @anasdevv in #341
New Contributors
Full Changelog: v9.0.0...v9.0.1
📶
Mongoose 9 support
Timeouts wrapper fixed
RLWrapperTimeouts can be imported from defaults:
import { RLWrapperTimeouts } from "rate-limiter-flexible";Use it with or without insuranceLimiter to handle long requests to a storage.
Read more in docs.
Thank you @florian-schunk
💧
Fix Insurance Strategy
This patch reverts v8.2.0 changes. Timeouts Wrapper changed how Insurance Strategy treats rejected promises from working stores.
If you're on the version 8.2.0, please update to v8.2.1.
The impact of 8.2.0 changes is that when main limiter rejected consume or any other method call because there were not enough points on store, insurance limiter consume method was mistakenly called. This logic is incorrect as Insurance Strategy should handle only store errors.
Timeouts wrapper
Added a new RLWrapperTimeouts.
It can be used with or without insuranceLimiter to handle long requests to a storage.
Thanks to @florian-schunk .
✌️
fix node-redis v4+ client is ready checks
- Improved
node-redispackage client is ready checks. All versions and cluster mode is supported now.
Thanks to @Neumann-Nils