rufus scheduler not running in production

前端 未结 2 938
醉酒成梦
醉酒成梦 2021-01-24 02:55

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

require \'rufus-scheduler\'
my_awesome_job = Rufus::Schedu         


        
相关标签:
2条回答
  • 2021-01-24 03:39

    So, I found the answer here

    I've added these two lines in nginx.conf (after passenger_enabled on;):

        rails_app_spawner_idle_time 0;
        passenger_min_instances 1;
    

    That keeps one passenger thread active.

    0 讨论(0)
  • 2021-01-24 03:58

    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.

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

    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.

    0 讨论(0)
提交回复
热议问题