Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Multiple Sidekiq Processes issue #323

Open
wants to merge 2 commits into
base: v2.3.1
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions lib/capistrano/tasks/systemd.rake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ namespace :sidekiq do
task command do
on roles fetch(:sidekiq_roles) do |role|
git_plugin.switch_user(role) do
git_plugin.systemctl_command(command)
git_plugin.process_block do |process|
git_plugin.systemctl_command(command, process: process)
end
end
end
end
Expand All @@ -24,7 +26,9 @@ namespace :sidekiq do
task :restart do
on roles fetch(:sidekiq_roles) do |role|
git_plugin.switch_user(role) do
git_plugin.quiet_sidekiq
git_plugin.process_block do |process|
git_plugin.quiet_sidekiq(process: process)
end
git_plugin.process_block do |process|
start_time = Process.clock_gettime(Process::CLOCK_MONOTONIC)
running = nil
Expand Down Expand Up @@ -69,7 +73,9 @@ namespace :sidekiq do
task :quiet do
on roles fetch(:sidekiq_roles) do |role|
git_plugin.switch_user(role) do
git_plugin.quiet_sidekiq
git_plugin.process_block do |process|
git_plugin.quiet_sidekiq(process: process)
end
end
end
end
Expand All @@ -84,7 +90,9 @@ namespace :sidekiq do
git_plugin.create_systemd_config_symlink(process)
end
end
git_plugin.systemctl_command(:enable)
git_plugin.process_block do |process|
git_plugin.systemctl_command(:enable, process: process)
end

if fetch(:sidekiq_service_unit_user) != :system && fetch(:sidekiq_enable_lingering)
execute :loginctl, 'enable-linger', fetch(:sidekiq_lingering_user)
Expand Down Expand Up @@ -218,8 +226,8 @@ namespace :sidekiq do
backend.execute(*execute_array, raise_on_non_zero_exit: false)
end

def quiet_sidekiq
systemctl_command(:kill, '-s', :TSTP)
def quiet_sidekiq(process: nil)
systemctl_command(:kill, '-s', :TSTP, process: process)
end

def switch_user(role, &block)
Expand Down