Unhandled promise rejections still occur
Author: joakimbengCreated Nov 28, 2018Updated Feb 16, 2023
Labelsenhancement
Description
The problem with unhandled promise rejections do still occur (see #1012).
Minimal, Working Test code to reproduce the issue.
Reproduced the issue in a separate repo: https://github.com/joakimbeng/bull-connection-problem
The code is essentially this:
'use strict';
const Queue = require('bull');
const queue = new Queue('my-queue');
queue.on('waiting', jobId => console.log('Job waiting', jobId));
queue.on('error', error => console.error('Queue Error', error));
queue.process(job => {
console.log('processing job', job.id);
});
queue.add({some: 'data'});
process.on('unhandledRejection', error => {
console.error('Unhandled Rejection', error);
process.exit(1);
});
Bull version
v3.5.2
Additional information
The two function calls that are causing this is the this.setWorkerName() and utils.isRedisReady in commands/index.js. (utils.isRedisReady is the function that's actually causing the issue in this.setWorkerName as well).
Also, the problem only occurs after the queue.process function have been called, which the #1012 did not cover.
Source: OptimalBits/bull