activerecord-refresh_connection icon indicating copy to clipboard operation
activerecord-refresh_connection copied to clipboard

Refresh ActiveRecord connection on each rack request

Results 2 activerecord-refresh_connection issues
Sort by recently updated
recently updated
newest added

EN) Fixed to disconnect all connection_handlers in ActiveRecord 6 and later versions. JA) ActiveRecord 6では `ActiveRecord::Base#clear_all_connections!` 及び `ActiveRecord::Base#clear_active_connections!` は `ActiveRecord::Base#default_connection_handler` に処理が移譲されるため、 単一のデータベース接続を扱う場合は正常に動作しますが、複数のデータベース接続を扱う場合はdefault_connection_handler以外のconnection_handlerの接続が切れません。 (多くの場合default_connection_handlerはPrimaryデータベース, それ以外のconnection_handlerはReplicaデータベースへ接続されています) `ActiveRecord::Base#connection_handlers` はActiveRecord 6で追加されたため、バージョン6以降とそれ以前で処理を分岐し、複数のデータベース接続においてもコネクションを切断出来るよう修正しました。

First of all, thank you for developing a great gem ## Summary In the change from rails5 to rails6, There were no changes to the `ActiveRecord::Base.clear_all_connections!` and `ActiveRecord::Base.clear_active_connections!` ActiveRecord methods...