我是Bull的新手,我的用例是在10秒后运行作业,为此,我使用以下代码
const options = {
delay: 10000, // in ms
jobId: myCustomUUID,
};
myQueue.add(someRandomData, options);在将它添加到队列之后,现在在几秒后,假设是4秒,我想从队列中删除该作业,因为由于某些条件,它不再需要,我如何实现它。我知道有job.remove()。而是如何对给定的jobId使用它。谁能帮帮我。
发布于 2021-07-09 04:50:25
// first find the job by Id
const job = await promotionEndQueue.getJob(data.id);
// then remove the job
await job?.remove();发布于 2021-10-17 14:01:05
要自动执行此操作,您可以通过以下方式进行设置:https://github.com/OptimalBits/bull/blob/HEAD/REFERENCE.md#user-content-queueadd
假设你有一个队列和一些模型。
const jobOptions = {
removeOnComplete: true,
removeOnFail: true
}
this.queue.add(model, jobOptions)https://stackoverflow.com/questions/67378770
复制相似问题