Permalink
Browse files

fix(worker): quiet_sidekiq now uses sidekiqctl instead of kill -USR1 …

…which is deprectaed

Fixes #93
  • Loading branch information...
ajgon committed Sep 29, 2017
1 parent 674b79b commit 1e9e32b91bed481e4d1ad2f9e4f375631de3f80d
Showing with 11 additions and 6 deletions.
  1. +11 −6 libraries/drivers_worker_sidekiq.rb
@@ -50,7 +50,8 @@ def quiet_sidekiq
pid_file = pid_file(process_number)
Chef::Log.info("Quiet Sidekiq process if exists: #{pid_file}")
next unless File.file?(pid_file) && pid_exists?(File.open(pid_file).read)
context.execute "/bin/su - #{node['deployer']['user']} -c 'kill -s USR1 `cat #{pid_file}`'"
execute_sidekiqctl 'quiet', pid_file
end
end
@@ -59,11 +60,7 @@ def stop_sidekiq
pid_file = pid_file(process_number)
timeout = (out[:config]['timeout'] || 8).to_i
context.execute(
"/bin/su - #{node['deployer']['user']} -c 'cd #{File.join(deploy_dir(app), 'current')} && " \
"#{environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')} " \
"bundle exec sidekiqctl stop #{pid_file} #{timeout}'"
)
execute_sidekiqctl 'stop', pid_file, timeout
end
end
@@ -81,6 +78,14 @@ def pid_exists?(pid)
def configuration
JSON.parse(out[:config].to_json, symbolize_names: true)
end
def execute_sidekiqctl(*params)
context.execute(
"/bin/su - #{node['deployer']['user']} -c 'cd #{File.join(deploy_dir(app), 'current')} && " \
"#{environment.map { |k, v| "#{k}=\"#{v}\"" }.join(' ')} " \
"bundle exec sidekiqctl #{params.map { |param| param.to_s.strip }.join(' ')}'"
)
end
end
end
end

0 comments on commit 1e9e32b

Please sign in to comment.