I have a NestJS server. I am using Bull library in my project. The problem I'm struggling with is jobs disappearing. To fix this, I logged all queue event listeners.
like so
@OnQueueCompleted()
async onCompleted(job: Job) {
console.log(`Job completed: ${job.id}`);
}
@OnQueueFailed()
async onFailed(job, error) {
console.log(`Job failed: ${job.id} with error: ${error}`);
}
@OnQueueActive()
async onActive(job) {
console.log(`Job active: ${job.id}`);
}
@OnQueueError()
async onError(job) {
console.log(`Job onError: ${job}`);
}
@OnQueueDrained()
async onDrained() {
console.log(`Job onDrained`);
}
@OnQueuePaused()
async onPaused(job) {
console.log(`Job onPaused: ${job}`);
}
@OnQueueProgress()
async onProgress(job) {
console.log(`Job onProgress: ${job}`);
}
@OnQueueStalled()
async onStalled(job) {
console.log(`Job onStalled: ${job}`);
}
@OnQueueWaiting()
async onWaiting(job) {
console.log(`Job onWaiting: ${job}`);
}
@OnQueueRemoved()
async onRemoved(job) {
console.log(`Job onRemoved: ${job}`);
}
After register tasks in queue, I got the logs like next,
8|dev | Job onWaiting: 1340
8|dev | Job onWaiting: 1341
8|dev | Job onWaiting: 1342
8|dev | Job onWaiting: 1343
8|dev | Job onWaiting: 1344
8|dev | Job onWaiting: 1345
8|dev | Job active: 1340
8|dev | Job active: 1342
8|dev | Job completed: 1342
8|dev | Job completed: 1340
8|dev | Job onDrained
8|dev | Job onDrained
I totally have no idea. How can I find cause of this problem?
- Additional information
- I am running two server which have different port (3001, 3002) in a EC2. These two server is sharing one redis server which is in localhost:6379. When I request to add queue to 3001 port, queue is added in 3001 port but tasks are processed in 3002 port.
What is the problem with me?