Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rate-limiting by groupKey - new implementation? #1510

Closed
doebi opened this issue Nov 2, 2022 · 6 comments
Closed

rate-limiting by groupKey - new implementation? #1510

doebi opened this issue Nov 2, 2022 · 6 comments

Comments

@doebi
Copy link

doebi commented Nov 2, 2022

I was about to file a bug for the missing groupKeyproperty in the Interface RateLimiterOptions when I discovered this commit:
81f780a

Where can I find information on the new implementation and how to use it?
Your docs are way out of date. :/

Thanks.

My original error message:

src/worker.ts:18:7 - error TS2322: Type '{ max: number; duration: number; groupKey: string; }' is not assignable to type 'RateLimiterOptions'.
  Object literal may only specify known properties, and 'groupKey' does not exist in type 'RateLimiterOptions'.

18       groupKey: 'foo'
         ~~~~~~~~~~~~~~~~~~~

  node_modules/bullmq/dist/esm/interfaces/worker-options.d.ts:26:5
    26     limiter?: RateLimiterOptions;
           ~~~~~~~
    The expected type comes from property 'limiter' which is declared here on type 'WorkerOptions'

@manast
Copy link
Contributor

manast commented Nov 2, 2022

Motivations for this change are here: https://blog.taskforce.sh/bullmq-3-0-release/

@doebi
Copy link
Author

doebi commented Nov 2, 2022

Thanks for the link.

So you're saying this feature is not available anymore unless I upgrade to the pay-for PRO version?

@manast
Copy link
Contributor

manast commented Nov 2, 2022

It is available on BullMQ version 2.x and on Bull, but removed in version >= 3. The feature in the Pro version is a superset of the group functionality in BullMQ that is much more robust and efficient as well.

@doebi
Copy link
Author

doebi commented Nov 2, 2022

Are you going to remove more features from BullMQ in the future?
Cause if so, I should highly reconsider another library.

@manast
Copy link
Contributor

manast commented Nov 2, 2022

Obviously, it is not some kind of long-term plan to remove features, on the contrary more will be added. I hope I made a good explanation in the blog post of why this particular feature was removed, for most users this was an improvement, as the rate limiter works much better now.

@doebi
Copy link
Author

doebi commented Nov 3, 2022

I figured that for my usecase it made more sense to just create a separate queue per logical group and have a fine-tuned global rate limit for each group.

As for the docs, I am now only sticking to the code or the automatically generated API docs. But I really appreciate the Patterns and Guide section. They helped me a lot in my architectural decision making.

@doebi doebi closed this as completed Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants