Skip to content

Commit

Permalink
Merge pull request #2516 from cjlarose/remove-nio-from-status-server
Browse files Browse the repository at this point in the history
Remove nio from status server
  • Loading branch information
cjlarose committed Dec 17, 2020
2 parents 4caf07a + 9122da9 commit 0475d70
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Bugfixes
* Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
* Fix compiler warnings, but skipped warnings related to ragel state machine generated code ([#1953])
* Fix phased restart errors related to nio4r gem when using the Puma control server (#2516)


## 5.1.1 / 2020-12-10
Expand Down
2 changes: 1 addition & 1 deletion lib/puma/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def start_control
app = Puma::App::Status.new @launcher, token

control = Puma::Server.new app, @launcher.events,
{ min_threads: 0, max_threads: 1 }
{ min_threads: 0, max_threads: 1, queue_requests: false }

control.binder.parse [str], self, 'Starting control server'

Expand Down
4 changes: 4 additions & 0 deletions test/config/prune_bundler_print_nio_defined.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prune_bundler true
before_fork do
puts "defined?(::NIO): #{defined?(::NIO).inspect}"
end
19 changes: 19 additions & 0 deletions test/test_integration_cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,25 @@ def test_json_gem_not_required_in_master_process
assert_match(/defined\?\(::JSON\): nil/, line)
end

def test_nio4r_gem_not_required_in_master_process
cli_server "-w #{workers} -C test/config/prune_bundler_print_nio_defined.rb test/rackup/hello.ru"

line = @server.gets
assert_match(/defined\?\(::NIO\): nil/, line)
end

def test_nio4r_gem_not_required_in_master_process_when_using_control_server
@control_tcp_port = UniquePort.call
control_opts = "--control-url tcp://#{HOST}:#{@control_tcp_port} --control-token #{TOKEN}"
cli_server "-w #{workers} #{control_opts} -C test/config/prune_bundler_print_nio_defined.rb test/rackup/hello.ru"

line = @server.gets
assert_match(/Starting control server/, line)

line = @server.gets
assert_match(/defined\?\(::NIO\): nil/, line)
end

def test_application_is_loaded_exactly_once_if_using_preload_app
cli_server "-w #{workers} --preload test/rackup/write_to_stdout_on_boot.ru"

Expand Down

0 comments on commit 0475d70

Please sign in to comment.