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

Comments

@dhnaranjo
Copy link

@dhnaranjo dhnaranjo commented Oct 16, 2019

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 in 610937f Oct 17, 2019
@ankane

This comment has been minimized.

Copy link
Owner

@ankane 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.