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

WIP: Fix for sync crash; Simplified pouchDbSyncOptions #2015

Closed

Conversation

chrisekelley
Copy link
Member

@chrisekelley chrisekelley commented Mar 23, 2020

Added pending to sync progress output

Description

This is a work-around for memory issues when syncing with the Cordova-Sqlcipher plugin

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Proposed Solution

I simplified the code for creating the selector in the mango query. If a site is using 2-way sync, we are recommending syncing all forms; therefore, I removed the code that builds a very long $or statement.

Before the sync, the code checks for sync-checkpoint, which is populated during the first sync.

 this.variableService.get('sync-checkpoint')

Limitations and Trade-offs

This code ignores any settings in Sync Configuration; instead, it syncs all forms. There is no checking of the couchdbSyncSettings.enabled property in each formInfo.

Also, after this sync process is done, the code progresses to this.syncCustomService.sync and does a push of most of the docs that were just synced (marked as customSyncSettings enabled and push). Note it is not a sync, using the changes feed, but instead a push using the doc _id's. Wouldn't it be better to do a couch sync instead? One thing the customSyncSettings can do is remove a field's value if a field is marked as private.

Added pending to sync progress output
}

if (syncDetails.deviceSyncLocations.length > 0) {
const locationConfig = syncDetails.deviceSyncLocations[0]
Copy link
Member Author

Choose a reason for hiding this comment

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

Would there ever be more than one deviceSyncLocation?

@chrisekelley chrisekelley changed the title Simplified pouchDbSyncOptions WIP: Fix for sync crash; Simplified pouchDbSyncOptions Mar 23, 2020
Different options for push and pull sync.
Hard coded localPouchOptions since to 0.
@chrisekelley
Copy link
Member Author

Current code features different configs for push and pull sync; the push sync to the remote server did not work when using the same checkpoint sequence id as the pull from remote server. Currently set local push 'since' variable to 0.

@chrisekelley
Copy link
Member Author

A major issue with the approach of using sync for push and pull is the difficulty in setting fields w/ PII to an empty value when it syncs to the remote server. I wonder if there could be a proxy server on the client side that would intercept the local push sync and remove the fields w/ PII?

@chrisekelley
Copy link
Member Author

chrisekelley commented Mar 25, 2020

We may need to tighten down the pouchOptions selector because there seem to be some extraneous docs being sync'd:

{
  "_id": "info",
  "_rev": "1-ed469193bcab366746737693d63fe8c8",
  "atUpdateIndex": 13,
  "tangerineModifiedByUserId": "install",
  "tangerineModifiedByDeviceId": "ee535b38-478d-474c-936d-dd1f1ff51901",
  "tangerineModifiedOn": 1585006659285,
  "buildId": "",
  "deviceId": "ee535b38-478d-474c-936d-dd1f1ff51901",
  "groupId": "",
  "buildChannel": "",
  "lastModified": 1585006659285
}

What local docs should not be sync'd?

guardrail for sync-protocol-2 deployments.
Storing different last_seq for push/pull in sync.
Re-instated the option for using $or and a big list of forms.
@chrisekelley
Copy link
Member Author

closed - moved to release/v3.8.2

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.

1 participant