Skip to content

[WIP] Refactored sync to batch reads - #7759

Draft
lougeniaC64 wants to merge 1 commit into
mainfrom
batch-sync-reads
Draft

lougeniaC64 wants to merge 1 commit into
mainfrom
batch-sync-reads

Conversation

@lougeniaC64

Copy link
Copy Markdown
Contributor

Pull Request checklist

  • Breaking changes: This PR follows our breaking change policy
    • This PR follows the breaking change policy:
      • This PR has no breaking API changes, or
      • There are corresponding PRs for our consumer applications that resolve the breaking changes and have been approved
  • Quality: This PR builds and tests run cleanly
    • Note:
      • For changes that need extra cross-platform testing, consider adding [ci full] to the PR title.
      • If this pull request includes a breaking change, consider cutting a new release after merging.
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Changelog: This PR includes a changelog entry in CHANGELOG.md or an explanation of why it does not need one
    • Any breaking changes to Swift or Kotlin binding APIs are noted explicitly
  • Dependencies: This PR follows our dependency management guidelines
    • Any new dependencies are accompanied by a summary of the due diligence applied in selecting them.

@mhammond mhammond left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this looks like the correct shape. Seeing if we can do that 1xretry would be perfect too given this is looking so reasonable - we'd treat 2 failures as a "harder" error and would usually end up with a successful sync, which is really where we want to end up - doing that as a followup would be ok, but you might find it fairly reasonable to do here.

/// already have been passed to `on_batch`, so callers must not advance any
/// timestamps unless this returns `Ok`.
/// - `on_batch` is always called at least once, even if the collection is empty,
/// because some engines (eg, tabs) do housekeeping in `stage_incoming`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

worth exploring if there is a better fix here - that seems like a tabs smell rather than something we should handle here. np if that gets complicated though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

it looks like I'd need to move remove_stale_clients and remove_old_pending_closures out of the tab engine's implementation of stage_incoming to limit on_batch to only be called when the collection isn't empty.

I put those changes in the the tabs-engine-refactor branch (the specific commit for these changes is here). It's not a big commit but enough changes for the tabs engine that I think separating it from the incident response is probably worthwhile.

Anyway, I'm going to add tests for this PR tomorrow and put it out for review.

telem_engine: &mut telemetry::Engine,
) -> Result<(), Error> {
match result {
Err(e @ Error::CollectionChangedDuringDownload) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

huh, never seen an "@ binding" before! :)

@lougeniaC64

lougeniaC64 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

this looks like the correct shape. Seeing if we can do that 1xretry would be perfect too given this is looking so reasonable - we'd treat 2 failures as a "harder" error and would usually end up with a successful sync, which is really where we want to end up - doing that as a followup would be ok, but you might find it fairly reasonable to do here.

Whoops! I forgot about update. This, then tests. Scratch that. Looks like the logins engine needs to be refactored to handle restarting a sync. I'll create a ticket for that to do as a followup.

This branch has not been deployed

No deployments
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.

2 participants