问题描述
我将用于我的node.js应用程序中的延迟作业。
I am using kue for delayed jobs in my node.js application.
我有一些问题需要弄清楚如何使用kue API重新启动作业,而不必从失败的作业列表中手动移动作业ID。
I have some problems to figure out how I can restart a job using the API of kue without having to move the id of a job manually from the the list of failed jobs to the list of inactive jobs using redis commands.
可以用kue吗?
我不可以吗?想要设置固定的重试次数-我只想重试特定的工作。
I don't want to set a fixed number of retry attempts - I just want to retry specific jobs.
也欢迎提出关于维护良好的kue替代方案的建议。
Suggestions for a well maintained alternative to kue are also welcome.
推荐答案
我不知道这是否有效,但是您可以尝试将作业的状态重置为活动状态,然后再次保存该作业:
i dont know if this is working but you could try to reset the state of the job to active, and save the job again:
job.on('failed', function() {
job.state('inactive').save();
编辑:将状态设置为非活动将正确地重新排队任务。
setting state to inactive will correctly re-enqueue the task.
这篇关于Node.js Kue如何重新启动失败的作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!