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]: Prioritized jobs doesn't process before non-prioritized ones #2798

Open
1 task done
BastienGenin opened this issue Oct 3, 2024 · 3 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@BastienGenin
Copy link

Version

v3.5.6

Platform

NodeJS

What happened?

Hello, I've encountered a problem with prioritized jobs that I can't figure out.

Let's say I have a queue full of many jobs waiting to be processed by the same worker in the same queue, all these jobs have a priority of 2.

When I add a new job to the queue with a non-specified priority (the highest priority possible if I've read the documentation correctly), it doesn't run immediately after the end of the process of a job with a priority of 2. Could you explain why this is?

Is there a connection with the concurrency settings of my worker? I didn't specify a concurrency when I created it.

// Queue
new Queue(
  "test",
  { connection: { ... } }
)

// Worker
new Worker(
  "test",
  () => { /* my processor code here */ },
  { 
    connection: { ... },
    lockDuration: 300000,
    maxStalledCount: 3,
    stalledInterval: 60000,
  }
)

Should I just upgrade to bullMQ 4/5.X.X ?

Thanks in advance.

How to reproduce.

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@BastienGenin BastienGenin added the bug Something isn't working label Oct 3, 2024
@BastienGenin BastienGenin changed the title [Bug]: [Bug]: Priority and Concurrency Oct 3, 2024
@BastienGenin BastienGenin changed the title [Bug]: Priority and Concurrency [Bug]: Prioritized jobs doesn't process before non-prioritized ones Oct 3, 2024
@manast
Copy link
Contributor

manast commented Oct 3, 2024

A job without priority should process before jobs with priorities. I do not know if there is something specific with your code that breaks this behaviour or a bug in your version of BullMQ. You should definitely upgrade as newer versions have a much better implementation of prioritised jobs, however if you have queues in production you may want to use new queues as your version is quite old and there may have incompatibilities with the newer ones.

@BastienGenin
Copy link
Author

BastienGenin commented Oct 3, 2024

Thanks for your quick response.

I will bump BullMQ to v5, write some test on my codebase and keep you updated if I encounter this again.

@roggervalf
Copy link
Collaborator

hi @BastienGenin, prioritized state was separated from wait state since v4 https://github.com/taskforcesh/bullmq/blob/master/docs/gitbook/changelogs/changelog-v4.md#400-2023-06-21, the behavior that you are facing is normal in old versiones from 1 to 3

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