You probably want to implement Rufus Scheduler as a separate workflow outside your application.
Instead of putting it as an initializer, I would do the Rake task that ran it.
desc "Starts the Scheduler worker"
task :scheduler do
require 'path/to/your/scheduler/file'
scheduler.join
end
Then just run rake schedulerto run it in the background.
Bonus: since your application now requires 2 processes side by side, use Foreman to control several processes of your application. You can do this by creating a file with the name Procfile:
web: thin start -p 4242
scheduler: rake scheduler
Then launch the application using Foreman: (first make sure gem install foreman)
$ foreman start
This will cause both processes at the same time.
source
share