-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Queue with Rate Limit 10 requests per second #2777
Comments
hi @bassamjarad I recommend you to migrate to bullmq package where rate limit logic is handled in better way https://docs.bullmq.io/guide/rate-limiting |
Thanks @roggervalf for the reply. I've moved to using BullMQ, but I'm afraid I'm still facing the issue. I've collected more info here:
I've noticed that "WORKER PROCESSOR" (generated from Worker Processor): so, basically, Worker is processing job#11 after exactly 1 second which is correct. (18.514 - 17.514 = 1000ms) However, the webserver that receives the requests and handles them ("WEBSERVER") so, webserver has received 10 requests in the window between (17.599 - 17.643) and handled them successfully. any ideas if there's a solution to such problem. |
hey it doesn't looks like there is an issue on bullmq side as these 10 jobs are picked at the time period, but at the time period where these api calls are made as you already mentioned. If you are receiving 429 errors even using a rate limit, you can consider on using https://docs.bullmq.io/guide/rate-limiting#manual-rate-limit our manual rate limit. Usually these errors comes with a remaining ttl header response that you can use |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Description
I'm implementing a dispatcher which receives many requests per second. It'll queue them using Bull, then, sends them to another service which is limited to 10 requests per second, however, I noticed while testing that if I send 11 requests per second, it'll actually process the 11 requests in less than 1 second (not following the limit exactly).
queue config:
After adding 11 requests to the queue, I logged the processor tasks and they're showing like this:
first job timestamp (start):
2024-10-09T19:59:01.111Z
last job (11th) timestamp (start):
2024-10-09T19:59:02.102Z
2102ms - 1111ms = 991ms
So, job#11 started earlier than it should have.
Bull version
4.16.3
The text was updated successfully, but these errors were encountered: