Database Optimization Revolution: Unnecessary Reads Slashed in Cast Merging!
New update streamlines processes, enhancing efficiency and accuracy in data management.
Commit Details:
fix: remove unnecessary database reads when merging casts (#1996) ## Motivation Since the base store implementation already handles conflicts for casts correctly: https://github.com/farcasterxyz/hub-monorepo/blob/main/apps/hubble/src/addon/src/store/store.rs#L195-L274 it feels wasteful to potentially use two additional DB lookups checking for an identical edge-case. This PR removes these two additional lookups and lets the base store logic handle casts in the same way that all other stores are handled. ## Change Summary - Remove two unnecessary database reads when merging casts ## Merge Checklist _Choose all relevant options below by adding an `x` now or at any time before submitting for review_ - [x] PR title adheres to the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standard - [x] PR has a [changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets) - [ ] PR has been tagged with a change label(s) (i.e. documentation, feature, bugfix, or chore) - [x] PR includes [documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs) if necessary. - [x] All [commits have been signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits) ## Additional Context If this is a relatively large or complex change, provide more details here that will help reviewers <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on removing unnecessary database reads when merging casts to improve efficiency and accuracy. ### Detailed summary - Removed unnecessary database reads when merging casts - Updated error message for conflicts with a more recent remove - Refactored the `find_merge_add_conflicts` function to remove unnecessary checks - Updated test cases to reflect the new error message for conflicts > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->