-
Notifications
You must be signed in to change notification settings - Fork 24
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 Limiter #38
Comments
Hey @jamesdoc! 👋🏻 You can define this configuration inside the defineConfig({
worker: {
limiter: {
// ...
},
},
}) |
Ahh, that makes sense and works well. Thank you @RomainLanz, however that appears to apply globally across all workers. Is it then possible to apply different limiters to different workers? (eg for different API calls with different rate limits) Eg - this simple proof of concept works as I expected it to outside of Adonis const worker30s = new Worker(
"oneInThirty",
async job => processJob(job),
{
connection: redisOpts,
// One job every 30 seconds
limiter: {
max: 1,
duration: 30000,
},
}
);
const worker10s = new Worker(
"oneInTen",
async job => processJob(job),
{
connection: redisOpts,
// One job every 10 seconds
limiter: {
max: 1,
duration: 10000,
},
}
); |
It is not doable at the moment, I may add the possibility to define queue worker directly in the configuration, allowing you to configure then from here. I need to think about it. |
Thanks Romain. I appreciate the thought and response. |
BullMQ offers the ability to set a rate limiter on a worker. Eg:
From the documentation here I'm not clear how to pass this configuration onto BullMQ. Is this possible at the moment?
The text was updated successfully, but these errors were encountered: