Skip to content
This repository was archived by the owner on Sep 16, 2020. It is now read-only.
This repository was archived by the owner on Sep 16, 2020. It is now read-only.

Synchronize function does not works everytime. #67

@stripathix

Description

@stripathix

Test Case:

Step 1) In chrome, I update the record of dataset then do synchronize() which gives Success
Step 2) Go to firefox and synchronize() there also Success is called.

Now in firefox I have the latest record that was updated in step (1).

On repeating the above steps multiple time, step(2) stops getting latest record updated in step (1) even when onSuccess is still called for firefox step(2).

Note: To resolve conflict I use deviceLastModifiedDate. Whichever is latest I use that.

`
bnUserPreferencesDataset.synchronize({onSuccess: function () {

                contents.fillDatasetMap();
            }, onConflict: function (dataset, conflicts, callback) {
                var resolved = [];
                var i = 0;
                while (i < conflicts.length) {
                    if (conflicts[i].localRecord.deviceLastModifiedDate > conflicts[i].remoteRecord.deviceLastModifiedDate) {
                        resolved.push(conflicts[i].resolveWithLocalRecord());
                    } else {
                        resolved.push(conflicts[i].resolveWithRemoteRecord());
                    }
                    i += 1;
                }
                if (resolved.length) {
                    dataset.resolve(resolved, function (err) {
                        if (err) {
                            return callback(false);
                        }
                        return callback(true);
                    });
                }
            }, onFailure: function (err) {
                console.log(err);
            }});`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions