Closed amitsuryavanshi closed 4 years ago
Are there performance considerations to think through? It’s been a while since I’ve looked through this code but based on your description, it sounds like this would need to get the IDs of all relationships to make its comparison. If a node has a significant number of existing rels, this could result in a large amount of data coming down the pipe.
Merging #1537 into master will increase coverage by
0.03%
. The diff coverage is100%
.
@@ Coverage Diff @@
## master #1537 +/- ##
==========================================
+ Coverage 93.23% 93.26% +0.03%
==========================================
Files 105 105
Lines 4757 4769 +12
==========================================
+ Hits 4435 4448 +13
+ Misses 322 321 -1
Impacted Files | Coverage Δ | |
---|---|---|
...node/query/query_proxy_methods_of_mass_updating.rb | 100% <100%> (ø) |
:arrow_up: |
lib/neo4j/active_node/query/query_proxy_methods.rb | 97.2% <0%> (+0.69%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 160b5ee...79d554b. Read the comment docs.
@subvertallchris I followed activerecord implementation https://github.com/rails/rails/blob/master/activerecord/lib/active_record/associations/collection_association.rb#L244 Assuming they would have done some benchmarking on performance.
I still have some questions about how it's loading nodes to make that comparison but I'm so uninvolved that I shouldn't even be poking my nose in at this point. Sorry for the distraction. :-)
@subvertallchris It is loading the nodes the same way as earlier. It is just at a few steps earlier than before. Your comments are always welcomed :)
I had another comment that this might be a breaking change if the relationship had properties which would currently be cleared, but with the new implementation would be preserved.
Closing this as this has been addressed with https://github.com/neo4jrb/neo4j/pull/1584.
…
Fixes #1531
This pull introduces/changes:
user.posts = [new_posts]
would fist check difference in existinguser.posts
withnew_posts
and create/delete only relevant posts. Earlier implementation would delete all existing posts relationships and create new relationships.