1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Revert "cluster.rb - rearrange SIGURG & fork_worker code, small test fix (#2449)"

This reverts commit ff5f145653.
This commit is contained in:
Nate Berkopec 2020-11-01 15:07:16 -07:00
parent d4d1ed374a
commit 39c36e11ac
No known key found for this signature in database
GPG key ID: BDD7A4B8E43906A6
2 changed files with 14 additions and 14 deletions

View file

@ -25,17 +25,6 @@ module Puma
@next_check = Time.now
@phased_restart = false
if @options[:fork_worker]
# Auto-fork after the specified number of requests.
if (fork_requests = @options[:fork_worker].to_i) > 0
@launcher.events.register(:ping!) do |w|
fork_worker! if w.index == 0 &&
w.phase == 0 &&
w.last_status[:requests_count] >= fork_requests
end
end
end
end
def stop_workers
@ -285,8 +274,19 @@ module Puma
# We do this in a separate method to keep the lambda scope
# of the signals handlers as small as possible.
def setup_signals
Signal.trap "SIGURG" do
fork_worker!
if @options[:fork_worker]
Signal.trap "SIGURG" do
fork_worker!
end
# Auto-fork after the specified number of requests.
if (fork_requests = @options[:fork_worker].to_i) > 0
@launcher.events.register(:ping!) do |w|
fork_worker! if w.index == 0 &&
w.phase == 0 &&
w.last_status[:requests_count] >= fork_requests
end
end
end
Signal.trap "SIGCHLD" do

View file

@ -213,7 +213,7 @@ RUBY
socks.each { |s| read_body s }
get_worker_pids(1, wrkrs - 1).each { |pid| refute_includes pids, pid }
refute_includes pids, get_worker_pids(1, wrkrs - 1)
end
def test_fork_worker_spawn