在 Delayed_job 中手动重试作业 [英] Manually Retry Job in Delayed_job

查看:14
本文介绍了在 Delayed_job 中手动重试作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Delayed::Job 的自动重试功能很棒,但我现在想手动重试一个作业.有没有一种方法我可以调用工作本身,比如......

Delayed::Job's auto-retry feature is great, but there's a job that I want to manually retry now. Is there a method I can call on the job itself like...

Delayed::Job.all[0].perform

或者跑,或者别的什么.我尝试了一些东西,并梳理了文档,但无法弄清楚如何执行手动重试作业.

or run, or something. I tried a few things, and combed the documentation, but couldn't figure out how to execute a manual retry of a job.

推荐答案

手动调用作业

Delayed::Job.find(10).invoke_job # 10 is the job.id

如果作业成功运行,这不会删除作业.您需要手动删除它:

This does not remove the job if it is run successfully. You need to remove it manually:

Delayed::Job.find(10).destroy

这篇关于在 Delayed_job 中手动重试作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆