redibox / job

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Job timeout breaks retries

Ehesp opened this issue · comments

When a job time out occurs AND retries is set, the job does timeout but does not retry again. Redis also seems to close the connection.

  it('Should retry the job if timeout is reached and retries is set', function(done) {
    this.timeout(10000);
    let count = 0;
    global.singleJob = function queueHandler(job) {
      count++;
      if (count === 1) {
        return new Promise((resolve) => {
          setTimeout(() => { resolve() }, 2000);
        });
      } else {
        return done();
      }
    };

    Hook.create('test', {
      runs: 'singleJob',
    }, {
      retries: 5,
      timeout: 1000,
    });
  });

Fixed in v2