Skip to content

Commit 7c1db8d

Browse files
committed
Always call preload_app! in Puma config
The puma documentation and code seem to disagree about whether `preload_app!` is the default depending on the number of workers. Worst case it's the default and making it explicit is no big deal.
1 parent 774c630 commit 7c1db8d

File tree

1 file changed

+4
-6
lines changed
  • railties/lib/rails/generators/rails/app/templates/config

1 file changed

+4
-6
lines changed

railties/lib/rails/generators/rails/app/templates/config/puma.rb.tt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ if rails_env == "production"
3232
# It defaults to 1 because it's impossible to reliably detect how many
3333
# CPU cores are available. Make sure to set the `WEB_CONCURRENCY` environment
3434
# variable to match the number of processors.
35-
processors_count = Integer(ENV.fetch("WEB_CONCURRENCY") { 1 })
36-
if processors_count > 1
37-
workers processors_count
38-
else
39-
preload_app!
40-
end
35+
workers_count = Integer(ENV.fetch("WEB_CONCURRENCY") { 1 })
36+
workers workers_count if workers_count > 1
37+
38+
preload_app!
4139
end
4240

4341
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.

0 commit comments

Comments
 (0)