From a4f508bc5002a8468e5874a4d5942f20c1b38323 Mon Sep 17 00:00:00 2001 From: w1mvy Date: Tue, 27 Oct 2015 20:29:13 +0900 Subject: [PATCH] Change pidfile handling, always add index to pidfile name --- lib/capistrano/tasks/capistrano2.rb | 6 +----- lib/capistrano/tasks/sidekiq.rake | 4 +--- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/capistrano/tasks/capistrano2.rb b/lib/capistrano/tasks/capistrano2.rb index 55861e2..9701b7c 100644 --- a/lib/capistrano/tasks/capistrano2.rb +++ b/lib/capistrano/tasks/capistrano2.rb @@ -34,11 +34,7 @@ def for_each_process(sidekiq_role, &block) sidekiq_processes = fetch(:"#{ sidekiq_role }_processes") rescue 1 sidekiq_processes.times do |idx| - if idx.zero? && sidekiq_processes <= 1 - pid_file = fetch(:sidekiq_pid) - else - pid_file = fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid") - end + pid_file = fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid") yield(pid_file, idx) end end diff --git a/lib/capistrano/tasks/sidekiq.rake b/lib/capistrano/tasks/sidekiq.rake index 0954b04..b975e31 100644 --- a/lib/capistrano/tasks/sidekiq.rake +++ b/lib/capistrano/tasks/sidekiq.rake @@ -46,9 +46,7 @@ namespace :sidekiq do next unless host.roles.include?(role) processes = fetch(:"#{ role }_processes") || fetch(:sidekiq_processes) processes.times do |idx| - pids.push (idx.zero? && processes <= 1) ? - fetch(:sidekiq_pid) : - fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid") + pids.push fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid") end end