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

[Bug]: Error: concurrency must be a number greater than 0 #2549

Open
1 task done
adamreisnz opened this issue Apr 30, 2024 · 3 comments
Open
1 task done

[Bug]: Error: concurrency must be a number greater than 0 #2549

adamreisnz opened this issue Apr 30, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@adamreisnz
Copy link

adamreisnz commented Apr 30, 2024

Version

v3.15.8

Platform

NodeJS

What happened?

It appears there is an unexpected breaking change somewhere between versions 3.2.2 and 3.15.8, where the concurrency of workers no longer works via the syntax:

     const worker = new Worker(type, async (job) => {
        await this.process(type, job)
      }, {connection, concurrency})

In version 3.15.8, this throws an error Error: concurrency must be a number greater than 0, despite passing in a non 0 value for the concurrency.

Have there been any breaking changes introduced in this API?
The docs seem to indicate it's still the same: https://docs.bullmq.io/guide/workers/concurrency

How to reproduce.

See code example in description above

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@adamreisnz adamreisnz added the bug Something isn't working label Apr 30, 2024
@manast
Copy link
Contributor

manast commented Apr 30, 2024

@adamreisnz is it possible that you are passing a string instead of a number? It is not a breaking change, more like it is detecting a potential error in your code that was not being detected before.

@andrews05
Copy link

Following up here on behalf of @adamreisnz:
Thanks @manast, turned out that was indeed the problem so should be easy for us to resolve. The issue can be closed.

@adamreisnz
Copy link
Author

adamreisnz commented May 1, 2024

Thanks @andrews05 , and yes, as we were feeding the vars in from heroku env vars, these were coming in as a string.

Appreciate that you may consider this a potential application error @manast, however, if previously a value of '1' was considered valid input, and now it no longer is, this still constitutes a major breaking change, as the workers would not spin up anymore (not even default to a concurrency of 1).

So I would recommend for future changes of this nature to bump your major version of the package to avoid any issues.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants