Skip to content

Commit

Permalink
fix(obliterate): remove job logs fixes #2050
Browse files Browse the repository at this point in the history
  • Loading branch information
manast authored May 31, 2021
1 parent 1139cd9 commit 6ccf2b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/commands/obliterate-2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions test/test_obliterate.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 6ccf2b9

Please sign in to comment.