Hey
queue.add({
id,
url
}, {
attempts: 1,
timeout: 5 * 1000,
removeOnComplete: true,
removeOnFail: true
})
process file
module.exports = async function (job) {
console.log('WAIT ', new Date() )
await delay(20 * 1000)
console.log('RESUME ', new Date())
console.log('I dont expect to see this message')
}
It throws
TimeoutError: operation timed out
at afterTimeout (/opt/node/savevideobot/downloader/node_modules/bluebird/js/release/timers.js:46:19)
at Timeout.timeoutTimeout [as _onTimeout] (/opt/node/savevideobot/downloader/node_modules/bluebird/js/release/timers.js:76:13)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)
But I expect it fails and doesn't continue after delay. am I right ?
not really. There is no way, that I am aware of, where a running function can be "cancelled". What happens is that the job is failed, but whatever is processing in the process function will continue to be executed.
In order to support real cancellation, other more advances approaches are needed, like using threads that can be killed if they exceed a given time etc. Check this issue: https://github.com/OptimalBits/bull/issues/479
Most helpful comment
not really. There is no way, that I am aware of, where a running function can be "cancelled". What happens is that the job is failed, but whatever is processing in the process function will continue to be executed.
In order to support real cancellation, other more advances approaches are needed, like using threads that can be killed if they exceed a given time etc. Check this issue: https://github.com/OptimalBits/bull/issues/479