Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout option not works as expected #486

Closed
raminious opened this issue Apr 4, 2017 · 1 comment
Closed

timeout option not works as expected #486

raminious opened this issue Apr 4, 2017 · 1 comment

Comments

@raminious
Copy link

raminious commented Apr 4, 2017

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 ?

@manast
Copy link
Member

manast commented Apr 4, 2017

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: #479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants