作者:异常登录了吖 | 来源:互联网 | 2023-01-02 09:25
Iwanttostartworkesforthejobdirectlyaftersomecertainmethod.So,Istarttheapplicationw
I want to start workes for the job directly after some certain method. So, I start the application with usual rails s. Upload some stuff, so the create method is invoked. After create method the :perform_analysis -method is delayed. Some data is inserted into delayed_jobs table. Normally I start the workers to work typing "script/delayed_job start"
in the command line. But I would like to start the workers work automatically, so I will type nothing.
我想在某种方法之后直接开始工作。所以,我用普通的rails启动应用程序。上传一些东西,所以调用create方法。在create方法之后:perform_analysis -method被延迟。一些数据被插入delayed_jobs表中。通常我会让工作人员在命令行中键入“script / delayed_job start”。但我想让工人自动开始工作,所以我什么都不会打字。
model:
模型:
after_create :perform_analysis
def perform_analysis
bla
end
handle_asynchronously :perform_analysis, :run_at => Proc.new { 5.minutes.from_now }
So, I run an application with rails s. I log in in my wep-page. Upload some files, after 5 min the jobs are delayed. Then the worker should start to work. I have found this page that does almost what I want but somehow the workers do not start at all. So the schedule.rb
is not run. Should I do something more that is not told on that webpage?
所以,我用rails s运行一个应用程序。我登录我的wep页面。上传部分文件,5分钟后作业延迟。然后工人应该开始工作。我发现这个页面几乎可以满足我的要求,但工作人员根本不会启动。所以schedule.rb没有运行。我应该做一些在该网页上没有告知的更多内容吗?
Is there any other possibility do it?
还有其他可能吗?
1 个解决方案