Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nil pool_config in legacy connection handling
This is a followup to #42537 because that PR only fixed the bug for the new connection handling but not legacy connection handling. In #41549 a user was getting an error that the `pool_config` was `nil` so the `all_connection_pools` method would raise an error. After getting a reproduction application I saw that if the application is misconfigured this can happen. For example, if an application uses `:all` for the writing role but does not set `config.active_record.writing_role = :all` then the `setup_shared_connection_pool` pool method will get a `nil` value for the `writing_pool_config` and set that in `set_pool_config`. I considered fixing this in `setup_shared_connection_pool` directly and raising an error there, but there's a possibility this _can_ happen in an external gem or application code if they're using these private APIs and realistically we never want any code, Rails or otherwise, to be able to set a `nil` pool config in the pools.
- Loading branch information