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

ActiveRecord adapter: wrap all reads/writes in with_connection #705

Merged
merged 1 commit into from
Mar 15, 2023

Conversation

bkeepers
Copy link
Collaborator

ConnectionPool#with_connection ensures the connection from the thread pool is checked back in if it wasn't already reserved for this thread. So using this adapter in a background thread won't permanently hold onto a connection that is infrequently used.

In a thread that already has an established connection (like web process) it will just reuse the connection.

cc @jhuber

@bkeepers bkeepers changed the base branch from main to poll-memoizer March 14, 2023 19:36
This ensures the connection from the thread pool is checked back in if it wasn't already reserved for this thread. So using this adapter in a background thread won't permanently hold onto a connection that is infrequently used.
@bkeepers bkeepers changed the base branch from poll-memoizer to main March 15, 2023 12:26
@bkeepers bkeepers merged commit f8f08ab into main Mar 15, 2023
@bkeepers bkeepers deleted the ar-with-connection branch March 15, 2023 19:39
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

2 participants