1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
This commit is contained in:
Nate Berkopec 2020-04-22 08:33:13 +09:00
parent dc3b9b89c2
commit b0b17f6ffd
No known key found for this signature in database
GPG key ID: BDD7A4B8E43906A6
5 changed files with 17 additions and 26 deletions

View file

@ -14,11 +14,12 @@
* Deprecations, Removals and Breaking API Changes
* `Puma.stats` now returns a Hash instead of a JSON string (#2086)
* `--control` has been removed. Use `--control-url` (#1487)
* `worker_directory` has been removed. Use `directory`
* min_threads now set by environment variables PUMA_MIN_THREADS and MIN_THREADS
* max_threads now set by environment variables PUMA_MAX_THREADS and MAX_THREADS
* max_threads default to 5 in MRI or 16 for all other interpretters
* preload by default if workers > 1 and interpretter supports workers
* `worker_directory` has been removed. Use `directory`.
* min_threads now set by environment variables PUMA_MIN_THREADS and MIN_THREADS. (#2143)
* max_threads now set by environment variables PUMA_MAX_THREADS and MAX_THREADS. (#2143)
* max_threads default to 5 in MRI or 16 for all other interpreters. (#2143)
* preload by default if workers > 1 and interpreter supports forking. (#2143)
* Puma::Plugin.workers_supported? has been removed. Use Puma.forkable? instead. (#2143)
* `tcp_mode` has been removed without replacement. (#2169)
* Daemonization has been removed without replacement. (#2170)
* Changed #connected_port to #connected_ports (#2076)

View file

@ -137,9 +137,8 @@ module Puma
@file_dsl = DSL.new(@options.file_options, self)
@default_dsl = DSL.new(@options.default_options, self)
if !@options[:prune_bundler]
default_options[:preload_app] = (@options[:workers] > 1) && ::Process.respond_to?(:fork)
default_options[:preload_app] = (@options[:workers] > 1) && Puma.forkable?
end
if block

View file

@ -13,13 +13,11 @@ module Puma
IS_WINDOWS
end
IS_TRUFFLE = RUBY_ENGINE == 'truffleruby'
def self.truffle?
IS_TRUFFLE
end
def self.mri?
RUBY_ENGINE == 'ruby' || RUBY_ENGINE.nil?
end
def self.forkable?
::Process.respond_to?(:fork)
end
end

View file

@ -107,10 +107,5 @@ module Puma
def in_background(&blk)
Plugins.add_background blk
end
def workers_supported?
return false if Puma.jruby? || Puma.windows? || Puma.truffle?
true
end
end
end

View file

@ -249,6 +249,10 @@ class TestConfigFile < TestConfigFileBase
assert_match expected, events.stdout.string
end
def test_config_does_not_load_workers_by_default
assert_equal 0, Puma::Configuration.new.options.default_options[:workers]
end
private
def assert_run_hooks(hook_name, options = {})
@ -285,8 +289,7 @@ end
class TestConfigEnvVariables < TestConfigFileBase
def test_config_loads_correct_min_threads
conf = Puma::Configuration.new
assert_equal 0, conf.options.default_options[:min_threads]
assert_equal 0, Puma::Configuration.new.options.default_options[:min_threads]
with_env("MIN_THREADS" => "7") do
conf = Puma::Configuration.new
@ -314,11 +317,6 @@ class TestConfigEnvVariables < TestConfigFileBase
end
end
def test_config_does_not_load_workers_by_default
conf = Puma::Configuration.new
assert_equal 0, conf.options.default_options[:workers]
end
def test_config_loads_workers_from_env
with_env("WEB_CONCURRENCY" => "9") do
conf = Puma::Configuration.new
@ -335,7 +333,7 @@ class TestConfigEnvVariables < TestConfigFileBase
def test_config_preloads_app_if_using_workers
with_env("WEB_CONCURRENCY" => "2") do
preload = Puma::Plugin.new.workers_supported?
preload = Puma.forkable?
conf = Puma::Configuration.new
assert_equal preload, conf.options.default_options[:preload_app]
end