Closed bkniffler closed 7 months ago
Could you please give some more details about what you are trying to achieve?
Lets say I want to call API a, which has these limitations:
Here is an example with Bottleneck:
const limiter = new Bottleneck({
reservoir: 100, // initial value
reservoirRefreshAmount: 100,
reservoirRefreshInterval: 60 * 1000,
maxConcurrent: 2,
});
With upstash ratelimit:
const ratelimit = new Ratelimit({
redis: Redis.fromEnv(),
limiter: Ratelimit.slidingWindow(100, "60 s"),
});
But we're missing the concurrency part to limit this to 2 maximum requests in parallel. Does this make sense @ogzhanolguncu ?
I believe, without locking we can't achieve that right now. We are about to release a distributed lock soon. Maybe we can couple it with this and allow users to limit the concurrent access.
Thanks @ogzhanolguncu, Sounds cool, is there any info about the distributed lock already?
We released it yesterday, here you go. https://github.com/upstash/lock
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
bump
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity.
I've just tried to use the ratelimitter of up stash again. lock doesn't really help because it neither allows to wait for until the lock is resolved nor does it allow to set a concurrency @ogzhanolguncu :(
We are planning to add a native support for concurrency pretty soon.
Great, would love to be pinged. I've implemented Bottleneck for now. Happy to switch to ratelimit-js once concurrency works well.
Thanks for this library! Would it be hard to add limitting concurrency? Would love to use this library with upstash redis to limit API calls, but a few APIs incur concurrency/parallelity limitations. Currently using bottleneck.