diff --git a/lib/commands/obliterate-2.lua b/lib/commands/obliterate-2.lua index 5ec3ab9..6055f5c 100644 --- a/lib/commands/obliterate-2.lua +++ b/lib/commands/obliterate-2.lua @@ -31,6 +31,7 @@ end local function removeJobs(parentKey, keys) for i, key in ipairs(keys) do rcall("DEL", baseKey .. key) + rcall("DEL", baseKey .. key .. ':logs') end maxCount = maxCount - #keys end diff --git a/test/test_obliterate.js b/test/test_obliterate.js index ec7eeb2..0f7dc72 100644 --- a/test/test_obliterate.js +++ b/test/test_obliterate.js @@ -124,6 +124,21 @@ describe('Obliterate', () => { expect(keys.length).to.be.eql(0); }); + it('should remove job logs', async () => { + const job = await queue.add({}); + + queue.process(job => { + return job.log('Lorem Ipsum Dolor Sit Amet'); + }); + + await job.finished(); + + await queue.obliterate({ force: true }); + + const { logs } = await queue.getJobLogs(job.id); + expect(logs).to.have.length(0); + }); + it('should obliterate a queue with high number of jobs in different statuses', async () => { const arr1 = []; for (let i = 0; i < 300; i++) {