Skip to content
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

Address soft deprecation of ActiveRecord::Base.connection #869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshuay03
Copy link

@joshuay03 joshuay03 commented Jun 12, 2024

Related: #705

Refs:

This will be soft deprecated in Rails 7.2.

The reason for this change is twofold.

  1. We're running on Rails Edge with active_record.permanent_connection_checkout = :deprecated and this call to #connection was logged as a violation. Our goal is to configure this with :disallowed some day. Even if this needed to be a permanent checkout, connection should ideally be swapped with lease_connection (this would require a specific check to ensure the Rails dependency is >= 7.2).

  2. Despite being called inside a with_connection block, this call actually leases a connection and doesn't return it back to the pool until the end of the request, which seems to have been intention behind ActiveRecord adapter: wrap all reads/writes in with_connection #705. This ensures we use the connection temporarily leased by with_connection.

@joshuay03 joshuay03 force-pushed the address-connection-deprecation branch from 28a27d9 to e5e221d Compare June 12, 2024 02:03
@joshuay03 joshuay03 changed the title Address soft deprecation of ActiveRecord::Base.connection Address soft deprecation of ActiveRecord::Base.connection Jun 12, 2024
@joshuay03 joshuay03 force-pushed the address-connection-deprecation branch from e5e221d to b33811b Compare June 12, 2024 02:04
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.

None yet

1 participant