mirror of https://github.com/rails/rails
Fix uninitialized constant error on Puma boot
Before, using the default `puma/config.rb` generated by `rails new`, Puma would fail to boot in production with this error: ``` ./config/puma.rb:16:in `block in _load_from': uninitialized constant Puma::DSL::Concurrent (NameError) from ./config/puma.rb:16:in `fetch' from ./config/puma.rb:16:in `_load_from' ``` This was because `Concurrent.physical_processor_count` was being referenced before the `Concurrent` constant was initialized. Fix by requiring `concurrent-ruby` just before the `Concurrent` constant is needed. Fixes #49323
This commit is contained in:
parent
42523a01db
commit
39ccb97e3c
|
@ -1,3 +1,10 @@
|
|||
* Require `concurrent-ruby` in `config/puma.rb` so that Puma can boot in
|
||||
production when `WEB_CONCURRENCY` is not explicitly specified.
|
||||
|
||||
Fixes #49323.
|
||||
|
||||
*Matt Brictson*
|
||||
|
||||
* Raise error when generating attribute with dangerous name.
|
||||
|
||||
The following will now raise an error as `save` and `hash` are already
|
||||
|
|
|
@ -13,6 +13,7 @@ threads min_threads_count, max_threads_count
|
|||
|
||||
# Specifies that the worker count should equal the number of processors in production.
|
||||
if ENV["RAILS_ENV"] == "production"
|
||||
require "concurrent-ruby"
|
||||
worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
|
||||
workers worker_count if worker_count > 1
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue