Skip to content

Commit

Permalink
perf(redis-connection): check redis version greater or equal than v6 …
Browse files Browse the repository at this point in the history
…only once (#2252)
  • Loading branch information
roggervalf committed Oct 31, 2023
1 parent 25cb3c3 commit dd93276
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1053,6 +1053,44 @@ describe('repeat', function () {
});
});

describe('when repeatable job is promoted', function () {
it('keeps one repeatable and one delayed after being processed', async function () {
const options = {
repeat: {
pattern: '0 * 1 * *',
},
};

const worker = new Worker(queueName, async () => {}, { connection });

const completing = new Promise<void>(resolve => {
worker.on('completed', () => {
resolve();
});
});

const repeatableJob = await queue.add('test', { foo: 'bar' }, options);
const delayedCount = await queue.getDelayedCount();
expect(delayedCount).to.be.equal(1);

await repeatableJob.promote();
await completing;

const delayedCount2 = await queue.getDelayedCount();
expect(delayedCount2).to.be.equal(1);

const configs = await repeat.getRepeatableJobs(0, -1, true);

expect(delayedCount).to.be.equal(1);

const count = await queue.count();

expect(count).to.be.equal(1);
expect(configs).to.have.length(1);
await worker.close();
});
});

it('should allow removing a named repeatable job', async function () {
const numJobs = 3;
const date = new Date('2017-02-07 9:24:00');
Expand Down

0 comments on commit dd93276

Please sign in to comment.