无法从Bull Queue Node Js中删除可重复的作业

问题描述 投票:0回答:1

当我尝试使用这种方法 - removeRepeatableByKey我得到removeRepeatableByKey不是一个功能错误。 queue_1.taskQueue.removeRepeatableByKey不是函数

我也无法通过taskQueue.removeRepeatable('task', { cron: '0 47 6 * * 4' });删除我的可重复工作

let jobOptions = {
        priority: queue_options.priority,
        repeat: { cron: '0 47 6 * * 4'},
        attempts: 3,
        removeOnComplete: true,
        jobId: queue_options.job_id,
        backoff: 3,
        timeout: 60000,
      };
      taskQueue.add('task', queue_options.data, jobOptions);

JOB的JSON:

{ id: "repeat:09854c8042eced1337a7d8eec9357528:1552526220000", name: "task", data: { eventName: "test", parameters: [ { my_JSON }, { my_JSON } ] }, opts: { repeat: { count: 1, cron: "0 47 6 * * 4", jobId: "myJobId" }, jobId: "repeat:09854c8042eced1337a7d8eec9357528:1552526220000", delay: 603096068, timestamp: 1551923123932, prevMillis: 1552526220000, priority: 1, attempts: 3, removeOnComplete: true, backoff: { type: "fixed", delay: 3 }, timeout: 60000 }, progress: 0, delay: 603096068, timestamp: 1551923123932, attemptsMade: 0, stacktrace: [ ], returnvalue: null, finishedOn: null, processedOn: null }

javascript node.js queue jobs
1个回答
0
投票

我现在能够删除可重复的工作。问题是我将作业添加到队列中:

let jobOptions = {
        priority: queue_options.priority,
        repeat: { cron: '0 47 6 * * 4' },
        attempts: 3,
        removeOnComplete: true,
        jobId: queue_options.job_id,
        backoff: 3,
        timeout: 60000,
      };
      taskQueue.add('task', queue_options.data, jobOptions);

并试图删除这样的工作:

let job = await taskQueue.removeRepeatable('task', {cron : '0 47 6 * * 4'});

我通过传递jobOptions来修复它,我能够从队列中成功删除该作业。

let job = await taskQueue.removeRepeatable('task' jobOptions);
© www.soinside.com 2019 - 2024. All rights reserved.