diff --git a/config/deploy.rb b/config/deploy.rb index 0f128c60d..2e92a2060 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -38,6 +38,8 @@ require './lib/recipes/unicorn' #require './lib/recipes/bluepill' require './lib/recipes/delayed_job' +set :workers_count, 2 + require './lib/recipes/resque' namespace :deploy do diff --git a/lib/recipes/resque.rb b/lib/recipes/resque.rb index 3ccc47414..d12bfffd5 100644 --- a/lib/recipes/resque.rb +++ b/lib/recipes/resque.rb @@ -20,11 +20,11 @@ Capistrano::Configuration.instance(:must_exist).load do end def stop_workers - run "kill -QUIT `cat #{ fetch(:current_path) }/tmp/pids/resque.pid`" + run "kill -QUIT `ps aux | grep resque | grep -v grep | awk '{ print $2 }'`" end def start_workers - run "cd #{fetch :current_path} && COUNT=2 QUEUE=fork_and_import #{ rails_env } BACKGROUND=yes PIDFILE=#{ fetch(:current_path) }/tmp/pids/resque.pid bundle exec rake resque:workers" + run "cd #{fetch :current_path} && COUNT=#{ workers_count } QUEUE=fork_and_import #{ rails_env } BACKGROUND=yes bundle exec rake resque:workers" end end end