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

Model.reindex(async: true) calls includes when enqueueing jobs #1325

Closed
dhnaranjo opened this issue Oct 16, 2019 · 1 comment
Closed

Model.reindex(async: true) calls includes when enqueueing jobs #1325

dhnaranjo opened this issue Oct 16, 2019 · 1 comment

Comments

@dhnaranjo
Copy link

Hello! So, I've got a model that I'm indexing with info from like... 11 associations. I noticed that when I call Model.reindex(async: true) that it queries all of the include'd associations, even though it's only taking the IDs and passing them to my job queue.

It looks like this line:

relation = relation.select("id").except(:includes, :preload) if async

might resolve the issue in the case of non-full but still async reindex jobs.

The app I'm working on is unfortunately currently not on a supported Rails version (sigh), so I'm just gonna chug along as it is, but I think it would be a nice fix for users that could benefit from a new version.

Thanks for y'alls efforts.

@ankane ankane closed this as completed in 610937f Oct 17, 2019
@ankane
Copy link
Owner

ankane commented Oct 17, 2019

Thanks @dhnaranjo, nice find and thanks for the detailed explanation. Fixed on master. It's just one line, so you might be able to backport in a fork.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants