scout_apm_ruby icon indicating copy to clipboard operation
scout_apm_ruby copied to clipboard

Fix deprecation warning in ActiveRecord 7.1 when clearing active connections

Open haffla opened this issue 9 months ago • 5 comments

Hi. Passing no argument to ActiveRecord::Base.connection_handler.clear_active_connections! was deprecated here and produces following log.

DEPRECATION WARNING: `clear_active_connections!` currently only applies to connection pools in the current role (`writing`). In Rails 7.2, this method will apply to all known pools, regardless of role. To affect only those connections belonging to a specific role, pass the role name as an argument. To switch to the new behavior, pass `:all` as the role name.

Rails documentation of method: https://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/ConnectionHandler.html#method-i-clear_active_connections-21

haffla avatar May 06 '24 17:05 haffla