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

Touch the model when reassigning #87

Closed
adamcooper opened this issue Oct 23, 2014 · 5 comments
Closed

Touch the model when reassigning #87

adamcooper opened this issue Oct 23, 2014 · 5 comments

Comments

@adamcooper
Copy link

Hi,

We are looking at using this gem and it looks like a great fit. We would like to be able to tell what models have changed as a result of the rebalancing. This is because we store the ordering column in a search index and don't want to have to update the entire list when a rebalance occurs.

Would you take a patch upstream that included a config option touch_record_when_rebalancing?

Thanks,
Adam

@mixonic
Copy link
Contributor

mixonic commented Oct 23, 2014

@adamcooper Howdy! Rebalancing spreads the records out across the entire integer space. It will touch every record. Maybe you mean rearranging?

https://github.com/mixonic/ranked-model/blob/master/lib/ranked-model/ranker.rb#L171

These are the smaller adjustments that avoid rebalancing when possible. You suggest that because update_all is used, we don't modify the updated_at, and you would like to have an option to do that?

@adamcooper
Copy link
Author

@mixonic - Yes. Having an option to also update the updated_at during the update_all calls is exactly what I'm looking for.

I had my terminology mixed up with rearranging vs. rebalancing.

Hm.. I didn't realize the rebalance would update every record in the list. We currently have hooks that update our index from this model. Some lists have 4000 items and to re-index them takes ~10 mins. I guess I may need to override the rebalance_ranks method to disable the indexing and queue up a background job..

@adamcooper adamcooper changed the title Touch the model when rebalancing Touch the model when reassigning Oct 23, 2014
@adamcooper
Copy link
Author

@mixonic - I was thinking along the lines of something like this: zozi@62a743b

@mixonic
Copy link
Contributor

mixonic commented Oct 24, 2014

@adamcooper looks great! Happy to merge if you can work up some tests.

@brendon
Copy link
Owner

brendon commented Jun 4, 2024

Closing this for now. Happy to look at it again if there's a need.

@brendon brendon closed this as completed Jun 4, 2024
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

No branches or pull requests

3 participants