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

Error: cannot check if job is finished in a closing queue. #1099

Closed
hbakhtiyor opened this issue Oct 23, 2018 · 2 comments
Closed

Error: cannot check if job is finished in a closing queue. #1099

hbakhtiyor opened this issue Oct 23, 2018 · 2 comments

Comments

@hbakhtiyor
Copy link
Contributor

Description

don't have exact steps for reproducing the error, but getting the error sometimes.

btw, why using sandbox approach is slowly?

at Timeout.<anonymous> (/demo/node_modules/bull/lib/job.js:462:19)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)

Minimal, Working Test code to reproduce the issue.

example.js
const Queue = require('bull');
const path = require('path');

const uuid = 1;

async function sleep(delay) {
  return new Promise((ok) => {
    setTimeout(ok, delay * 1000);
  });
}

(async () => {
  const a = 1;
  const b = 2;

  const queue = new Queue('add');
  queue.process(path.join(__dirname, 'processor.js'));

  const job = await queue.add({a, b}, {jobId: uuid, removeOnComplete: true, removeOnFail: true});

  queue.on('global:progress', async (jobId, data) => {
    if(jobId === job.id) {
      if (data === 0) {
        queue.close();
        console.log("closing");
        return;
      }

      await sleep(3);
      console.log(data);
    }
  });

  const result = await job.finished();
  console.log('finished processing', result);
})();
processor.js
async function addFunc(a, b, cb) {
  await sleep(1);
  cb(1);
  await sleep(2);
  cb(2);
  await sleep(2);
  return a + b;
}

module.exports = async function (job) {
  const result = await addFunc(
    job.data.a,
    job.data.b,
    (data) => {
      job.progress(data);
    }
  );

  job.progress(0);

  return Promise.resolve(result);
}

Bull version

v3.4.8

Additional information

node: v10.12.0
redis: 4.0.11

@stale
Copy link

stale bot commented Jul 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 12, 2021
@stale stale bot removed the wontfix label Jul 13, 2021
@stale
Copy link

stale bot commented Sep 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 11, 2021
@stale stale bot closed this as completed Sep 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants