Skip to content

QueueEvents class never exits  #119

@seawatts

Description

@seawatts

Whenever I try to use the QueueEvents class my process hangs forever because of this line: https://github.com/taskforcesh/bullmq/blob/master/src/classes/queue-events.ts#L65
However, If i just remove the QueueEvents class then it will exit correctly.

Example:

// test.ts

import { Worker, Queue, QueueEvents } from 'bullmq';

(async () => {

const queueName = `test-queue-1`;
const queue = new Queue(queueName);

const queueEvents = new QueueEvents(queueName)
await queueEvents.waitUntilReady();

const worker = new Worker(queueName, () => console.log('processed'));

await queue.add('hi', {});

await new Promise(resolve => queueEvents.on('completed', resolve));

await worker.close();
await queue.close();
await queueEvents.close();
})();

I used wtfnode in order to test this and got these results

$ tsc
$ wtfnode dist/test.js

completed

[WTF Node?] open handles:
- File descriptors: (note: stdio always exists)
  - fd 1 (tty) (stdio)
  - fd 2 (tty) (stdio)
- Sockets:
  - 127.0.0.1:50644 -> 127.0.0.1:6379
- Timers:
  - (5000 ~ 5 s) (anonymous) @ ./node_modules/bullmq/dist/utils.js:33

It looks like the error here https://github.com/taskforcesh/bullmq/blob/master/src/classes/queue-events.ts#L62 is Connection is closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions