You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of now two methods exists that already implement this: untilMidnightTonight, untilEndOfMonth
However it would be great to have these available as well for shorter time intervals such as:
untilEndOfMinute, untilEndOfHour
Some of the external api's I work with rely on clock minutes. So if you have a rate limit of 100 per second and you call them all at 12:50:50, it will reset at 12:51:00 and not at 12:51:50. This has been a common issue for me when setting up rate limiting. I used to make a Redis key with a stringified version of the current time (with minute/hour notation depending on what the limit reset was). Now that I discovered this amazing package (thanks by the way, I'm becoming a huge fan), it affects me once again by having to substract the seconds till the next minute etc, makes the code hard to read.
Leaky bucket algorithm
This one is also a very popular rate limiting algorithm (used by Amazon Marketplace api for example). This would be so great if it were also supported out of the box.
Atomic cache operations
I'm not sure how many people are affected by this. However, when an app is doing calls at extremely high concurrency, it would be very beneficial to prevent accidental 429's by implementing Atomic operations to set and get the hits on cache stores such as Redis. There are GETSET,LUA evals etc which are very suitable for this. I believe that this can make the threshold obsolete as it becomes impossible to hit the configured limits, even at high concurrency.
The text was updated successfully, but these errors were encountered:
Until time intervals
As of now two methods exists that already implement this:
untilMidnightTonight, untilEndOfMonth
However it would be great to have these available as well for shorter time intervals such as:
untilEndOfMinute, untilEndOfHour
Some of the external api's I work with rely on clock minutes. So if you have a rate limit of 100 per second and you call them all at 12:50:50, it will reset at 12:51:00 and not at 12:51:50. This has been a common issue for me when setting up rate limiting. I used to make a Redis key with a stringified version of the current time (with minute/hour notation depending on what the limit reset was). Now that I discovered this amazing package (thanks by the way, I'm becoming a huge fan), it affects me once again by having to substract the seconds till the next minute etc, makes the code hard to read.
Leaky bucket algorithm
This one is also a very popular rate limiting algorithm (used by Amazon Marketplace api for example). This would be so great if it were also supported out of the box.
Atomic cache operations
I'm not sure how many people are affected by this. However, when an app is doing calls at extremely high concurrency, it would be very beneficial to prevent accidental 429's by implementing Atomic operations to set and get the hits on cache stores such as Redis. There are GETSET,LUA evals etc which are very suitable for this. I believe that this can make the threshold obsolete as it becomes impossible to hit the configured limits, even at high concurrency.
The text was updated successfully, but these errors were encountered: