Releases: SGrondin/bottleneck
Releases · SGrondin/bottleneck
Fix .on()/.once() fix, Fix Group Cluster GC
- Fixed
.on()
and.once()
not returning the object itself, which broke "chaining" and compatibility with Node's own events. Fixes #59 , thanks @bkw for the bug report - Fixed key reuse for Groups when using Clustering. Fixes #57 , thanks @TheGame2500 for the bug report
Fix when using Cluster+Group+Expiration
- Fixed an issue when using Clustering in a Group with
maxConcurrent
greater than0
with jobs having anexpiration
time. A job timing out in a limiter in the group would lower the count of running jobs in all limiters in the group, which would result in going over the rate limit. - Improved the error message when returning a non-Promise value to
schedule()
Babel, Clustering for Groups
- Bottleneck v2 now ships code that is compatible with Node v6 instead of requiring Node v7.6. Thanks Babel.
- Groups now support Clustering. Each limiter is automatically garbage collected, including its Redis data and even in the cases where Node loses connection to Redis.
- Returning a promise to Bottleneck from within an event listener on a limiter now ensures your promise gets fully executed before exiting your program.
- The
depleted
event now passes anempty
argument.
`depleted` event, better Redis error
- Added the
depleted
event. It is triggered when thereservoir
reaches0
. - Return a friendly error message when a client tries to submit requests to a limiter which is still in the process of connecting to Redis and therefore cannot accept the request yet.
Fixed TypeScript issue with noImplicitAny
- Fixed compilation when compiling using TypeScript and the
--noImplicitAny
compiler option
Version 2
Bottleneck Version 2
This new version is almost 100% compatible with Version 1 and it adds some powerful features such as:
- True Clustering support. You can now rate limit and schedule jobs across multiple Node.js instances. It uses strictly atomic operations to stay reliable in the presence of unreliable clients. 100% of Bottleneck's features are supported.
- Support for custom job weights. Not all jobs are equally resource intensive.
- Support for job timeouts. Bottleneck can automatically cancel jobs if they exceed their execution time limit.
- Many improvements to the interface, such as better method names and errors, improved debugging tools.
Upgrading to v2
The internal algorithms essentially haven't changed from v1, but many small changes to the interface were made to introduce new features.
All the breaking changes:
- Bottleneck v2 uses ES6/ES2015. v1 will continue to use ES5 only.
- The Bottleneck constructor now takes an options object.
- Jobs take an optional options object.
- Removed
submitPriority()
, usesubmit()
with an options object instead. - Removed
schedulePriority()
, useschedule()
with an options object instead. - The
rejectOnDrop
option is nowtrue
by default. - Use
null
instead of0
to indicate an unlimitedmaxConcurrent
value. - Use
null
instead of-1
to indicate an unlimitedhighWater
value. - Renamed
changeSettings()
toupdateSettings()
, it now returns a promise to indicate completion. It takes the same options object as the constructor. - Renamed
nbQueued()
toqueued()
. - Renamed
nbRunning
torunning()
, it now returns its result using a promise. - Removed
isBlocked()
. - Changing the Promise library is now done through the options object like any other limiter setting.
- Removed
changePenalty()
, it is now done through the options object like any other limiter setting. - Removed
changeReservoir()
, it is now done through the options object like any other limiter setting. - Removed
stopAll()
. Use thereservoir
feature to disable execution instead. check()
now accepts an optionalweight
argument, and returns its result using a promise.- The
Cluster
feature is now calledGroup
. This is to distinguish it from the new v2 Clustering feature. - The
Group
constructor takes an options object to match the limiter constructor. - Renamed the
Group
changeTimeout()
method toupdateSettings()
, it now takes an options object.
Version 2 is more user-friendly, powerful and reliable.
Version 2: beta 4
v2.0.0-beta.4 2.0.0-beta.4
Version 2: beta 3
v2.0.0-beta.3 2.0.0-beta.3
Version 2: beta 2
v2.0.0-beta.2 2.0.0-beta.2
Version 2: beta 1
v2.0.0-beta.1 2.0.0-beta.1