aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Schneeman <richard.schneeman@gmail.com>2016-09-14 10:26:46 -0500
committerGitHub <noreply@github.com>2016-09-14 10:26:46 -0500
commit1d7b00d6072e4749e90fb4bc8307dc06b052848d (patch)
treeb015f64c64f8d2a31a53857037af94236debbd14
parent71ce02d300e2e6eda0ca6344317bce4d7dcd47ee (diff)
parent1b6f3a2ef7de3c1d22123659504b100c418da872 (diff)
downloadrails-1d7b00d6072e4749e90fb4bc8307dc06b052848d.tar.gz
rails-1d7b00d6072e4749e90fb4bc8307dc06b052848d.tar.bz2
rails-1d7b00d6072e4749e90fb4bc8307dc06b052848d.zip
Merge pull request #26487 from prathamesh-sonpatki/move-preload-section-up
Move comment about disconnecting pool close to comment about preload
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/puma.rb15
1 files changed, 8 insertions, 7 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/puma.rb b/railties/lib/rails/generators/rails/app/templates/config/puma.rb
index a44bfbabec..7ee948002e 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/puma.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/puma.rb
@@ -32,6 +32,14 @@ environment ENV.fetch("RAILS_ENV") { "development" }
#
# preload_app!
+# If you are preloading your application and using Active Record, it's
+# recommended that you close any connections to the database before workers
+# are forked to prevent connection leakage.
+#
+# before_fork do
+# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
+# end
+
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
@@ -43,13 +51,6 @@ environment ENV.fetch("RAILS_ENV") { "development" }
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
#
-# If you are preloading your application and using ActiveRecord, it's
-# recommended that you close any connections to the database before workers
-# are forked to prevent connection leakage.
-#
-# before_fork do
-# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
-# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart