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

Add support for ActiveRecord::Relation#load_async method. #6

Merged
merged 1 commit into from
Apr 23, 2022

Conversation

maxshend
Copy link
Contributor

@maxshend maxshend commented Apr 20, 2022

Hello, @DmitryTsepelev

A few days ago I tested how the gem works with ActiveRecord::Relation#load_async and as expected it didn't work because this method performs database queries outside of the main thread. But instantiation of models is done in the main thread. So I've created a patch for ActiveRecord::FutureResult class (it's used to get results from such queries).

I had to change DatabaseCleaner configurations because load_async inside transactions executes queries in the main thread.

Would like to know your opinion about this changes. Thank you!

@DmitryTsepelev
Copy link
Owner

LGTM, thank you! Let's try it out 🙂

@DmitryTsepelev DmitryTsepelev merged commit b535e5a into DmitryTsepelev:main Apr 23, 2022
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.

2 participants