Skip to content

Commit

Permalink
implemented ability to split sidekiq_roles by count of sidekiq-proces…
Browse files Browse the repository at this point in the history
…ses for cap3
  • Loading branch information
alexyakubenko committed Mar 31, 2015
1 parent c8b0f2e commit 5628d3b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lib/capistrano/tasks/sidekiq.cap
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,17 @@ namespace :sidekiq do

def processes_pids
pids = []
fetch(:sidekiq_processes).times do |idx|
pids.push (idx.zero? && fetch(:sidekiq_processes) <= 1) ?
fetch(:sidekiq_pid) :
fetch(:sidekiq_pid).gsub(/\.pid$/, "-#{idx}.pid")

sidekiq_roles = Array(fetch(:sidekiq_role))
sidekiq_roles.each do |role|
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")
end
end

pids
end

Expand Down

0 comments on commit 5628d3b

Please sign in to comment.