繁体   English   中英

无法从 Bull Queue 节点 Js 中删除可重复作业

[英]Unable to remove Repeatable Job From Bull Queue Node Js

当我尝试使用此方法时 - removeRepeatableByKey我得到removeRepeatableByKey不是函数错误。 queue_1.taskQueue.removeRepeatableByKey 不是函数

我无法通过taskQueue.removeRepeatable('task', { cron: '0 47 6 * * 4' });删除我的可重复作业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);

作业的 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 }

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

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);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM