taskforcesh / bullmq

BullMQ - Message Queue and Batch processing for NodeJS and Python based on Redis
https://bullmq.io
MIT License
5.69k stars 369 forks source link

[Bug]: worker is not closing on Bun #2185

Open dimonnwc3 opened 10 months ago

dimonnwc3 commented 10 months ago

Version

v4.11.0

Platform

NodeJS

What happened?

When using Bun 1.0.0, calling close on worker hangs indefinitely

How to reproduce.

import { Queue, Worker } from "bullmq"

export const bullMQBaseOptions = {
  connection: {
    host: "localhost",
    port: 6379,
  },
}

export const usersQueue = new Queue("users", bullMQBaseOptions)

export const usersWorker = new Worker(
  "users",
  async (job) => {},
  bullMQBaseOptions,
)

usersQueue.add("users-cleanup", null, {
  repeat: {
    every: 10000,
  },
})

setTimeout(async () => {
  console.log("should close")
  await Promise.all([usersQueue.close(), usersWorker.close()])
  console.log("closed")
}, 2000)

Relevant log output

❯ bun ./bin/worker.js
[0.02ms] ".env"
should close


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
manast commented 10 months ago

Thanks for reporting this. I removed the Bug label as Bun is not officially supported yet https://github.com/taskforcesh/bullmq/issues/2177

nullndr commented 1 month ago

With the latest version of Bun (1.1.9) this seems to have been fixed