Ruby-on-rails 您如何告诉特定的 Delayed::Job 在控制台中运行?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6946041/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do you tell a specific Delayed::Job to run in console?
提问by Trip
For some reason, Delayed::Job's has decided to queue up but not excecute anything even though I've restarted it several times, even kill -9'd it and restarted it. It won't run any jobs.
出于某种原因,Delayed::Job's 决定排队但不执行任何操作,即使我已经重新启动了几次,甚至杀死了 -9 并重新启动了它。它不会运行任何作业。
Can I , in /console, specify a specific job and tell it to work?
我可以在 /console 中指定一个特定的工作并让它工作吗?
Ex:.. Delayed::Job.find(x).run
前任:.. Delayed::Job.find(x).run
回答by David Tuite
You can also do it like this:
你也可以这样做:
Delayed::Worker.new.run( Delayed::Job.find(x) )
回答by schiza
answering how to run specific job from console:
回答如何从控制台运行特定作业:
Delayed::Job.find(x).invoke_job
Delayed::Job.find(x).invoke_job
but you must remember that it won't run any other things like destroying job that was done or so on. just running the job/task.
但您必须记住,它不会运行任何其他事情,例如销毁已完成的工作等。只是运行作业/任务。
回答by rassom
On Heroku I had a "stuck" job and just had to run heroku restartfor the worker/job to start again.
在 Heroku 上,我有一份“卡住”的工作,只需要heroku restart为工人/工作重新开始。

