ackama / rails-template

Application template for Rails 7 projects; preloaded with best practices for TDD, security, deployment, and developer productivity.
Other
300 stars 15 forks source link

Remove before_fork, on_worker_boot callbacks from puma config if they are no longer required #493

Open eoinkelly opened 12 months ago

eoinkelly commented 12 months ago

Our puma config includes:

  before_fork do
    ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
  end

  on_worker_boot do
    ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
  end

The puma docs do not mention this as being required. I haven't found anything online saying it is required but https://github.com/heroku/barnes/issues/36 suggests that it might not be.

The default config/puma.rb generated by Rails 7 does not include these lines.

We should remove these lines if they are not required. Determining that needs more research and then trying it on some real apps before commiting it to this template.