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

Merged
merged 2 commits into from
Jun 13, 2025

Conversation

wojtha
Copy link
Contributor

@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

@ddalcino
Copy link

ddalcino commented Jun 3, 2025

Thank you, this helped me with an issue I was having with #2425

@yahonda
Copy link
Collaborator

yahonda commented Jun 13, 2025

Related to rails/rails#44573

@yahonda yahonda merged commit 9953abe into rsim:master Jun 13, 2025
1 check passed
yahonda added a commit to yahonda/oracle-enhanced that referenced this pull request Jun 13, 2025
Add optional argument to reconnect for Rails 7.1+ compatibility
yahonda added a commit that referenced this pull request Jun 13, 2025
Merge pull request #2433 from wojtha/fix-rails-71-reconnect
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
3 participants