[refs #510] Add multiple workers. Change kill and start logic
This commit is contained in:
parent
7a3caf01bd
commit
da33173700
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue