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]: job.processedBy is undefined after second worker run #3073

Open
1 task done
dimonnwc3 opened this issue Feb 12, 2025 · 0 comments · May be fixed by #3077
Open
1 task done

[Bug]: job.processedBy is undefined after second worker run #3073

dimonnwc3 opened this issue Feb 12, 2025 · 0 comments · May be fixed by #3077
Labels
bug Something isn't working

Comments

@dimonnwc3
Copy link

dimonnwc3 commented Feb 12, 2025

Version

v5.40.2

Platform

NodeJS

What happened?

When passing name to worker options, it's supposed to show this name on the job.processedBy property. It works for the first time but doesn't for all sequentially runs. It can be reproduced only when there is a timeout inside worker function.

How to reproduce.

queue.ts

import { Queue } from "bullmq"

const q = new Queue("super-task", { connection: { url: "localhost" } })

while (true) {
  await q.add("super-task", {})
  await new Promise((res) => setTimeout(res, 5000))
}

worker.ts

import { Worker } from "bullmq"

new Worker(
  "super-task",
  async (job) => {
    console.log(job.processedBy) // <- job.processedBy is undefined after second run
    await new Promise((resolve) => setTimeout(resolve, 5000))
  },
  {
    connection: { url: "localhost" },
    name: "processedBy-custom-name",
  },
)

Relevant log output

processedBy-custom-name
undefined
undefined
...

Code of Conduct

  • I agree to follow this project's Code of Conduct
@dimonnwc3 dimonnwc3 added the bug Something isn't working label Feb 12, 2025
@dimonnwc3 dimonnwc3 changed the title [Bug]: job.processedBy is undefined after second worker call [Bug]: job.processedBy is undefined after second worker run Feb 12, 2025
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

Successfully merging a pull request may close this issue.

1 participant