Skip to content

Add optional argument to reconnect for Rails 7.1+ compatibility #2433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wojtha
Copy link

@wojtha wojtha commented Apr 25, 2025

This PR fixes #2432

ActiveRecord.connection.verify! fails on Rails 7.1.0+ when reconnection is needed, because Rails 7.1 added an optional argument restore_transactions: false to the #reconnect! method which is used e.g. inside the #verify!

This change has been implemented in rails/rails#44573 and it appeared in Rails 7.1.0beta1 for the first time.

Oracle Enhanced Driver Implementation

def reconnect! # :nodoc:
super
_connection.reset!
rescue OracleEnhanced::ConnectionException => e
@logger.warn "#{adapter_name} automatic reconnection failed: #{e.message}" if @logger
end

Rails 7.1.0beta1 Implementation

https://github.com/rails/rails/blob/2d7bc98897053658ad904b12e5b19a52b8cc3617/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L560-L565

Rails 7.1.5.1 Implementation

https://github.com/rails/rails/blob/14c115b120ed089331ff3dc13f36bd9129ced33d/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L680-L712

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActiveRecord.connection.verify! fails on Rails 7.1.0+ when reconnection is needed
1 participant