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

Minimum retry time seems to be 5 seconds #62

Open
kibertoad opened this issue Nov 4, 2023 · 7 comments
Open

Minimum retry time seems to be 5 seconds #62

kibertoad opened this issue Nov 4, 2023 · 7 comments

Comments

@kibertoad
Copy link

kibertoad commented Nov 4, 2023

Retry timeout parameter doesn't seem to matter unless it's more than 5 seconds.

If I set my backoff strategy to exponential/1, my test (which does retry once) finishes in 5 seconds 220 msecs.
If I set my backoff strategy to exponential/1000, it finishes within approximately same time.
Same for exponential/4000

But if I set it to exponential/6000, it finishes in 6 seconds 220 msecs, and execution time keeps growing accordingly if I increase it even further.

I can understand why this makes sense for production, but for tests burning 5 seconds for each test that does a retry is unacceptable. Would it be possible to support setting very low retry delays?

Reproduction

Any simple job that throws on execution will do, it is not related to logic being executed. Logs indicate that Bullmq doesn't even attempt to retry the failed job until 5 seconds pass, e. g.:

[2023-11-04 21:25:18.944 +0200] INFO: Finished processing test_job (error) (2b74c8e9-bbcc-496c-95f8-cdbaf4f818c1)
[2023-11-04 21:25:23.990 +0200] INFO: Started processing test_job (2c76a048-9266-4d3f-90b5-0d7d6c6f5d06)

Versions:

  • bullmqpro 6.6.1
  • bullmq 4.12.3
@manast
Copy link
Contributor

manast commented Nov 5, 2023

5 seconds seems like a suspicious value, as it is the standard blocking timeout, maybe we are not properly calculating the block timeout based on the backoff value, @roggervalf what do you think?

@roggervalf
Copy link
Collaborator

hi @kibertoad, I cannot replicate your case, it'll be good if you can provide a test case to replicate it

@roggervalf
Copy link
Collaborator

btw I'm adding one extra test case using exponential backoff and it's not taking more than 2 seconds taskforcesh/bullmq#2266

@kibertoad
Copy link
Author

@roggervalf sure, I'll try to create a repro tonight.

@kibertoad
Copy link
Author

Sorry for the delay. I can still reproduce the issue with the latest bullmq. Working on a repro now.

@kibertoad
Copy link
Author

OK, so it previously went away for us after we set the following for our code:

if (this.config.isTest && typeof preparedOptions.backoff === 'object') {
			preparedOptions.backoff.delay = 0
		}

However, backoff.delay seems to be ignored when concurrency of the queue is larger than 1, and that resets the delay back to 5 seconds in all test cases for whatever reason, regardless of what configuration there is.

I'll try to create a repro again this time, it should be easier to reproduce.

@kibertoad
Copy link
Author

kibertoad commented Apr 8, 2024

@manast Actually, this seems to be a regression from the past: taskforcesh/bullmq#1505

We are seeing the same behaviour with BullMQ 5.4.2/BullMQ Pro 7.0.0

This is for a non-recurring job with concurrency > 1, attempts = 3 and backoff.delay = 0

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

3 participants