mirror of
https://github.com/OptimalBits/bull.git
synced 2026-07-02 00:17:41 +08:00
fix(obliterate): remove job logs fixes #2050
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
Reference in New Issue
Block a user