m5d2yq
Last Updated: February 25, 2016
·
342
· joshteng
10504ee74cc7e9984600710e51f08fc9

Running Clockwork as a unicorn process to avoid one extra dyno

worker_processes 2 # amount of unicorn workers to spin up
timeout 3000

@resque_pid = nil
@resque_pid2 = nil
before_fork do |server, worker|
  @resque_pid ||= spawn("bundle exec rake jobs:work")
  @resque_pid2 ||= spawn("bundle exec clockwork app/clock.rb")
end

Disclaimer: I haven't tested this. This bit of code was found on someone else's blog (http://www.nambrot.com/posts/1-heroku-dyno-on-steroids)

Say Thanks
Respond