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

faster lookup of holdings #99

Merged
merged 4 commits into from
Jul 19, 2021
Merged

faster lookup of holdings #99

merged 4 commits into from
Jul 19, 2021

Conversation

mwarin
Copy link
Contributor

@mwarin mwarin commented Jul 2, 2021

Changes to ClusterHolding, specifically to the methods check_for_duplicate_uuids! and find_old_holdings, in order to improve speed when adding holdings.

@aelkiss aelkiss requested a review from jsteverman July 7, 2021 18:06
Copy link
Contributor

@jsteverman jsteverman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See note about large clusters, but this looks good to me.

[cluster.holdings.to_a.find {|h| h == holding && h.date_received != holding.date_received }]
# Build a fast lookup for holdings
# {update_key1: h1, update_key2: h2, ...}
@cluster_holdings_lookup ||= cluster.holdings.group_by(&:update_key)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to not use @cluster_holdings_lookup for the large clusters as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, other than that we wanted to have it tested & working for the non-large-cluster branch.

@mwarin mwarin merged commit 224a2af into master Jul 19, 2021
@mwarin mwarin deleted the holdings-perf-mw branch July 19, 2021 20: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.

3 participants