Fix Sidekiq process group killing

This commit is contained in:
Nick Thomas 2019-03-07 12:37:59 +00:00
parent 7bbdb2a29f
commit 12bc7e0bab
No known key found for this signature in database
GPG key ID: 2A313A47AFADACE9
2 changed files with 6 additions and 3 deletions

View file

@ -35,8 +35,11 @@ module Gitlab
# signals from outside the process group, but that isn't fatal.
def self.blindly_signal_pgroup!(signal)
old_trap = trap(signal, 'IGNORE')
Process.kill(signal, "-#{Process.getpgrp}")
trap(signal, old_trap)
begin
Process.kill(signal, 0)
ensure
trap(signal, old_trap)
end
end
end
end

View file

@ -44,7 +44,7 @@ describe Gitlab::SidekiqSignals do
expect(Process)
.to receive(:kill)
.with(signal, "-#{Process.pid}")
.with(signal, 0)
.ordered
expect(described_class)