Permalink
Browse files

do not halt deployment if no servers are going to run sidekiq workers

  • Loading branch information...
1 parent b1b58f2 commit 6cffbb9adbed0c6ce78408743fabb44adeac1b80 @bzanchet bzanchet committed Apr 20, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/sidekiq/capistrano.rb
@@ -10,23 +10,23 @@
namespace :sidekiq do
desc "Quiet sidekiq (stop accepting new work)"
- task :quiet, :roles => lambda { fetch(:sidekiq_role) } do
+ task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
run "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi"
end
desc "Stop sidekiq"
- task :stop, :roles => lambda { fetch(:sidekiq_role) } do
+ task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
run "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout} ; fi"
end
desc "Start sidekiq"
- task :start, :roles => lambda { fetch(:sidekiq_role) } do
+ task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
rails_env = fetch(:rails_env, "production")
run "cd #{current_path} ; nohup #{fetch(:bundle_cmd, "bundle")} exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{current_path}/tmp/pids/sidekiq.pid >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
end
desc "Restart sidekiq"
- task :restart, :roles => lambda { fetch(:sidekiq_role) } do
+ task :restart, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
stop
start
end

0 comments on commit 6cffbb9

Please sign in to comment.