OptimalBits / bull

Premium Queue package for handling distributed jobs and messages in NodeJS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stalledInterva set to 0, an error occurs

wangkunmeng opened this issue · comments

Description

import Bull from 'bull';
import { setTimeout } from 'timers/promises';
import { randomUUID } from 'crypto';
import moment from 'moment';

const queue = new Bull('running-stalled-job-' + randomUUID(), {
    redis: { port: 6379, host: '127.0.0.1' },
    defaultJobOptions: {
        attempts: 2,
        removeOnComplete: true,
        removeOnFail: true
    },
    settings: {
        lockRenewTime: 2500,
        lockDuration: 2500,
        stalledInterval: 0,
        maxStalledCount: 1
    }
});

queue.process((job) => {
    console.log(moment().format('HH:mm:ss'), JSON.stringify(job.toJSON()));
    return setTimeout(5000);
});

queue.add({ foo: randomUUID() });

image
image
image
image

Minimal, Working Test code to reproduce the issue.

(An easy to reproduce test case will dramatically decrease the resolution time.)

Bull version

4.11

Additional information

We can thrown an exception here, but 0 will never be a valid setting for stalledInterval.

@manast it's listed in the documentation as 0 meaning it'll never check. That might be something to update; there's been several updates with confusion about that