redibox / job

High performance, robust and flexible queue/worker system powered by redis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Job#retry() doesn't fire

Ehesp opened this issue · comments

Trying to build a test for the Job rety() method, however hitting an issue:

  it('Should allow the instance of the job to retry itself', (done) => {
    let count = 0;
    global.singleJob = function queueHandler() {
      console.log('doing job')
      count++;
      if (count === 2) {
        return done();
      }
      return Promise.reject();
    };

    const job = Hook.create('test', {
      runs: 'singleJob',
    }).onFailure(() => {
      job.retry();
    });
  });

job.retry(); is a function, but since it's a multi-exec it's async, but doesn't seem to be triggering the second job.

Fixed in v2