Using Que gem with Phusion PassengerPosted by: Girish | 16 Sep 2014 | Comments
Que is a background jobs gem for Ruby and PostgreSQL, an excellent alternative to DelayedJob if you are using Postgres.
We can run
Que workers (threads) within the web process.
has usage information about using
puma servers, but not
After a bit of googling, came across passenger docs which says
PhusionPassenger.on_event(:starting_worker_process) hook to specify our own custom code, when a new process is forked.
application.rb with following and it worked flawlessly!
if defined?(PhusionPassenger) PhusionPassenger.on_event(:starting_worker_process) do |forked| if forked # We're in smart spawning mode. ActiveRecord::Base.establish_connection Que.mode = :async end end end