issue_2656_workaround_for_rails_issue_33600.rb 965 B

12345678910111213141516171819202122
  1. # This temporary workaround for issue #2656.
  2. # The root cause is an issue in Rails: https://github.com/rails/rails/issues/33600
  3. # It disables database connnection reaping by setting `reaping_frequency` to 0 for each environment in the config/database.yml file.
  4. # It restores the DB connection reaping behavior Rails > 5.2 had.
  5. # It was proposed in a comment on the Rails issue: https://github.com/rails/rails/issues/33600#issuecomment-415395901
  6. # It was confirmed by @matthewd (a Rails core maintainer) in another comment: https://github.com/rails/rails/issues/33600#issuecomment-415400522
  7. module Rails
  8. class Application
  9. class Configuration < ::Rails::Engine::Configuration
  10. alias database_configuration_original database_configuration
  11. def database_configuration
  12. database_configuration_original&.transform_values do |config|
  13. config.merge(
  14. 'reaping_frequency' => 0
  15. )
  16. end
  17. end
  18. end
  19. end
  20. end