rufus调度程序未在生产中运行

问题描述:

我有一个在nginx&下运行的Rails服务器.乘客.我的sheduler.rb看起来像这样

I have a rails server running under nginx & passenger. My sheduler.rb looks like this

require 'rufus-scheduler'
my_awesome_job = Rufus::Scheduler.new

my_awesome_job.cron '59 23 * * *' do
    #do something
end

如果我将工作设置为接下来的2-3分钟(用于测试),则一切正常.但是,正如我在生产中所需要的那样,它并不是每天23:59开始的.我不知道问题出在哪里.

Everything works fine if I set the job for the next 2-3 minutes (for test). But this one, as I need it in production, does not start at 23:59 every day. I don't know where is the problem.

谢谢.

此问题很可能是由R​​ufus调度程序后台线程在Phusion Passenger生成子进程作为智能生成方法的一部分后终止而导致的.

Most likely, this problem is caused by the Rufus scheduler background thread being terminated after Phusion Passenger spawns a child process as part of the smart spawning method.

阅读解释了生成方法. 您所遇到的特定问题可能是智能生成警告#2:需要恢复线程.

Read Spawning methods explained. The specific issue you're suffering from is probably Smart spawning caveat #2: the need to revive threads.

您需要使用文档中的机制来恢复Rufus调度程序线程.我不确定您需要进行哪个API调用,因此也许您可以询问Rufus调度程序作者.

You need to revive the Rufus scheduler thread using the mechanism in the documentation. I'm not exactly sure which API call you need to make, so maybe you can ask the Rufus scheduler authors.

或者,您可以使用直接"产卵方法.它的效率较低,但是避免了诸如此类的兼容性问题.

Alternatively, you can use the 'direct' spawning method. It's less efficient but it avoids compatibility issues like this.