delay_job:如何强制处理失败的作业 [英] delayed_job: how to force processing of failed jobs
问题描述
我正在维护一个Rails应用程序,在该应用程序上我正在运行delay_job gem以发送电子邮件。
I am maintaining a rails app, on which i'm running the delayed_job gem for sending emails.
我只是注意到我所有的延迟工作都失败了最近几天由于应用程序中的错误。现在,该错误已修复,我想尽快处理这些作业,但是它们已经进行了太多的失败尝试,并且工作人员将它们从数据库中拉出了很长时间。
I just noticed that all my delayed jobs've been failing the last few days due to a bug in the application. Now the bug is fixed and I want to process the jobs asap, but they are with already too many failed attempts, and the worker pulls them from the database with a huge delay.
我已经尝试过通过更新delay_jobs表并将尝试次数设置为较小的次数,并将run_at属性设置为当前时间,但是仍然没有帮助。
I've tried by updating the delayed_jobs table and set the number of attempts to a smaller number and the run_at attribute to the current time, but still didn't help.
您能告诉我如何强制工人执行它们吗?
Can you tell me how can I force the worker to execute them ?
推荐答案
您可以手动启动它,尝试
You can start it manually, try
Delayed::Job.all.each { |j| j.invoke_job }
或
Delayed::Job.all.each { |j| j.payload_object.perform }
这篇关于delay_job:如何强制处理失败的作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!