1

I am using PouchDB 5.3 with Couchbase Sync Gateway 1.2, with the sync function. It works without any problem when I use a small set of records (20 .. 50). But I have problems when I use 3K, because the first time that try to synchronize, it has around 17K request to the server.

This is the configuration with this problem:

this.sync = function(remoteDatabase, onComplete, onError) {
    database.sync(remoteDatabase, {
        live: true,
        retry: false
    }).on('change', function(change) {
        // yo, something changed!
        console.log("Sync Change");
    }).on('paused', function(info) {
        // replication was paused, usually because of a lost connection
        console.log("Sync Paused");
        if (onComplete)
            onComplete();
    }).on('active', function(info) {
        // replication was resumed 
        console.log("Sync Active");
    }).on('error', function(err) {
        // totally unhandled error (shouldn't happen)
        console.log("Sync Error", err);
        if (onError)
            onError();
    }).on('complete', function(info) {
        console.log("Sync Complete");
    }).then(function(info) {
        console.log("Sync Complete");
    });
}

Also, it is not possible to detect when this 17k requests are done.

If I set the live method to false, it only has around of 3k requests, but after that, it is not possible to sync when some changes is made on any of both sides.

This are the set of repeated requests (with differents uuids)

http://...._bulk_docs?_nonce=1457702282722
http://...._bulk_docs?_nonce=1457702282722
http://....._revs_diff?_nonce=1457702282818
http://....._revs_diff?_nonce=1457702282818
http://....._local/EhRrzqajjvWCiEqNXBk87A%3D%3D?
http://....._local/EhRrzqajjvWCiEqNXBk87A%3D%3D?

Any idea about how to prevent this 17k requests??

And if this is mandatory to do, any idea about how to detect once is finished?

Thanks!

Follow this problem on https://github.com/pouchdb/pouchdb/issues/4975

todotresde
  • 1,770
  • 2
  • 19
  • 25
  • I see similar results - possibly the same issue. I get a repetition of the same three requests, but without the nonce. This seems to be used to increase the local sequence counter for every document that is synced. The data sync itself however uses batches with `_changes` and `_all_docs` – Stefan Henze Mar 11 '16 at 13:42

1 Answers1

0

The GitHub issue has since been closed by Nolan as bing most likely related to CouchBase Sync Gateway not supporting _bulk_get with application/json response. For the time being, it seems that this is due to limited compatibility between CouchBase Sync Gateway and PouchDB.

Stefan Henze
  • 2,711
  • 23
  • 22