New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rufus not triggering when running Puma as a daemon (Rufus 3.7, Puma 5.2.1) #320
Comments
Hello, so in Rails daemon mode, Puma only advertises "Booting Puma" and nothing more. It may be going in clustered mode. if you put this in a on_worker_boot do |worker_number|
puts ". worker ##{worker_number} starting ..."
end Does it behave differently in daemon versus non-daemon? If yes, you could start the scheduling from there. Maybe: on_worker_boot do |worker_number|
puts ". worker ##{worker_number} starting ..."
if worker_number == 0
Rufus::Scheduler.singleton.every '5s' do
puts ".. Hello, it's #{Time.now}"
end
end
end https://puma.io/puma/#configuration |
I need to look up more about this clustering mode you mention, but for now here's the result of running the code you suggested:
|
It seems |
OK, it seems you would need to use a newer version of Rails or to call I've tested with a setup similar to yours and, like you, starting with If you use |
Thank you for the help John. It seems that in the latest version of Puma they removed daemon support (puma/puma#2170) . I've decided that the easiest way of working around this is to run my app in a Docker container, and could spin up a separate container for the scheduled jobs, after putting them in a rake task. |
You're welcome! |
I seem to be encountering the same symptoms as puma/puma#607, which was apparently solved several years ago but maybe resurfaced in a newer update?
Rails 4.2.11
Ruby 2.5.2
Rufus Scheduler 3.7
Puma 5.2.1
Here is my scheduler:
config/initializers/rufus-scheduler.rb
Rails server as a terminal process (not a daemon)
Output (running as a server in console, RAILS_ENV=development)
I can confirm that it was writing to the file in
tmp/rufus-log.txt
as expected too.Rails server as a terminal process (as a daemon)
RAILS_ENV=development
If I tail the Rails log I see nothing, except a lone DB query that it runs for another initializer at startup.
The text was updated successfully, but these errors were encountered: