question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migration from node-rate-limiter package: Using RateLimiterQueue with BurstyRateLimiter?

See original GitHub issue

Hi

In the documentation for BurstyRateLimiter it claims All limiters from this package can be used for BurstyRateLimiter creation. However, if you try to construct one with RateLimiterQueue it fails because it doesn’t adhere to the necessary interface.

I am trying to migrate from TokenBucket from the https://github.com/jhurliman/node-rate-limiter package. This behaves in such a way that you can burst but also has an outstanding request queue so you can await on the calls for the bucket to refill.

I want to take the FIFO logic & promise awaits from RateLimiterQueue but the burst of BurstyRateLimiter.

Without writing a wrapper this currently is not achievable.

KR

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
animircommented, Aug 24, 2022

This wasn’t possible with BurstyRateLimiter because it would add a large chunk of tokens at a designated time rather than drip feed as a token bucket would do.

I understand you need it to be re-filled in small chunks. You could try to create a limiter with long duration like 14 days and re-fill 1 point every second with setTimeout using reward function, but not sure if it is worth it.

1reaction
animircommented, Aug 24, 2022

@dt-atkinson I think, it can be. There is an example in docs here

Read more comments on GitHub >

github_iconTop Results From Across the Web

BurstyRateLimiter · animir/node-rate-limiter-flexible Wiki - GitHub
The idea is to rate limit traffic by two limiters: limiter and burst limiter. If there are no points in the first, try...
Read more >
rate-limiter-flexible - npm
Node.js rate limiter by key and protection from DDoS and Brute-Force attacks in process Memory, Redis, MongoDb, Memcached, MySQL, ...
Read more >
rate-limiter-flexible - npm Package Health Analysis - Snyk
Node.js rate limiter by key and protection from DDoS and Brute-Force attacks in process Memory, Redis, MongoDb, Memcached, MySQL, PostgreSQL, Cluster or PM ......
Read more >
Overall example · animir/node-rate-limiter-flexible Wiki
Count and limit requests by key with atomic increments in single process or distributed environment. - Overall example · animir/node-rate-limiter-flexible Wiki.
Read more >
The node-rate-limiter-flexible from animir - GithubHelp
Whenever your application grows, it is ready. Prepare your limiters in minutes. Friendly. No matter which node package you prefer: redis or ioredis ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found