Page MenuHomePhabricator

[lib] Refactor integrity reducer to process threadStore ops with sqlite ops
ClosedPublic

Authored by will on Mar 11 2024, 6:33 AM.
Tags
None
Referenced Files
F3391868: D11298.diff
Sat, Nov 30, 6:24 AM
Unknown Object (File)
Mon, Nov 11, 5:21 PM
Unknown Object (File)
Mon, Nov 11, 11:56 AM
Unknown Object (File)
Wed, Nov 6, 8:03 AM
Unknown Object (File)
Fri, Nov 1, 8:42 PM
Unknown Object (File)
Oct 22 2024, 4:10 AM
Unknown Object (File)
Oct 22 2024, 3:16 AM
Unknown Object (File)
Oct 17 2024, 1:55 PM
Subscribers

Details

Summary

Refactor integrity reducer to use sqlite ops

Depends on D11287

Test Plan

flow check. Not sure how to best test this right now. Might need to test later in diff stack

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

will requested review of this revision.Mar 11 2024, 7:07 AM
lib/reducers/integrity-reducer.js
76–81

Both replace and remove operations both support operating on several hashes at once by taking an array as an argument. However, in this reducer, I have the operation payload contain only one id to remove or one integrity thread hash to replace at a time.

Do I have to worry about bundling these operations together if there are consecutive replace/remove operations?

will retitled this revision from [sqlite] [lib] Refactor integrity reducer to process threadStore ops with sqlite ops to [lib] Refactor integrity reducer to process threadStore ops with sqlite ops.Mar 11 2024, 3:11 PM
kamil added a reviewer: michal.
kamil added a subscriber: michal.

flow check. Not sure how to best test this right now. Might need to test later in diff stack

You could (only on your dev environment) leave the old logic above and result in state store in a variable, then compare it with the result state from ops and compare using _isEqual

lib/reducers/integrity-reducer.js
76–81

Unfortunately, I think we have to leave it as you implemented it because of ops ordering - but @michal could say more as he implemented this logic.

lib/reducers/integrity-reducer.js
76–81

I think it's correct to bundle consecutive replace operations (and remove operations although I think these are less of a problem) if they aren't separated by another operation. And it would improve performance. If it's not too hard to implement, could we try and do it?

lib/reducers/integrity-reducer.js
78 ↗(On Diff #38152)

I wasn't able to find any specific examples in our codebase for grouping items like this. Let me know if this solution makes sense. Tested in future diffs and behavior looks correct

98–102 ↗(On Diff #38152)

I didn't bundle our remove operations as we can already include several in a payload. Let me know if this also needs bundling.

This revision is now accepted and ready to land.Mar 19 2024, 5:24 AM