Skip to content

Commit

Permalink
Allow custom options per process
Browse files Browse the repository at this point in the history
  • Loading branch information
mrsimo committed Mar 11, 2015
1 parent 6d16ad6 commit 04da503
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/capistrano/tasks/capistrano2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
_cset(:sidekiq_timeout) { 10 }
_cset(:sidekiq_role) { :app }
_cset(:sidekiq_processes) { 1 }
_cset(:sidekiq_options_per_process) { nil }

if fetch(:sidekiq_default_hooks)
before 'deploy:update_code', 'sidekiq:quiet'
Expand Down Expand Up @@ -56,6 +57,11 @@ def start_process(pid_file, idx)
fetch(:sidekiq_queue).each do |queue|
args.push "--queue #{queue}"
end if fetch(:sidekiq_queue)

if process_options = fetch(:sidekiq_options_per_process)
args.push process_options[idx]
end

args.push fetch(:sidekiq_options)

if defined?(JRUBY_VERSION)
Expand Down
4 changes: 4 additions & 0 deletions lib/capistrano/tasks/sidekiq.cap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace :load do
set :sidekiq_timeout, -> { 10 }
set :sidekiq_role, -> { :app }
set :sidekiq_processes, -> { 1 }
set :sidekiq_options_per_process, -> { nil }
# Rbenv and RVM integration
set :rbenv_map_bins, fetch(:rbenv_map_bins).to_a.concat(%w(sidekiq sidekiqctl))
set :rvm_map_bins, fetch(:rvm_map_bins).to_a.concat(%w(sidekiq sidekiqctl))
Expand Down Expand Up @@ -94,6 +95,9 @@ namespace :sidekiq do
end
args.push "--config #{fetch(:sidekiq_config)}" if fetch(:sidekiq_config)
args.push "--concurrency #{fetch(:sidekiq_concurrency)}" if fetch(:sidekiq_concurrency)
if process_options = fetch(:sidekiq_options_per_process)
args.push process_options[idx]
end
# use sidekiq_options for special options
args.push fetch(:sidekiq_options) if fetch(:sidekiq_options)

Expand Down

0 comments on commit 04da503

Please sign in to comment.