Closed ronycohen closed 9 years ago
It sounds like the issue is that you are not using pouchdb-replication-stream. :) Having one request per document is a feature of normal PouchDB replication. Maybe you didn't use the proxy
option to set a checkpoint, and so nothing is getting replicated via pouchdb-replication-stream, and when you switch over to normal replication it just starts from scratch?
I'm only using the pouchdb-replication-stream :
memoryStream = stream = null;
var memoryStream = window.memorystream;
var stream = new memoryStream();
$q.all([
factory.localDB.load(stream),
factory.remoteDB.dump(stream,factory.remoteSyncOption)
]).then(function (result) {
console.debug('Hooray the stream replication is complete!', result); });
If I comment the dump line : // factory.remoteDB.dump(stream,factory.remoteSyncOption) I dont have this behavior.
100% sure.
Here is the Option passed :
remoteSyncOption : {
live: true,
retry : true,
since : null,
batch_size : 150,
back_off_function: function (delay) {
if (!delay || delay === 0) {
return 1000;
}
return delay * 2;
},
filter : function(item) {
var type = factory.parse_id(item._id).type || item.type;
return type != 'forcedFreq' && type != 'preference' && type != 'exchangeType' && type != '$email' && type !='relationstate';
}
}
Oh right sorry, I see the issue.
The issue is that you are using pouchdb-replication-stream client-side. It is not really designed to be run that way if your goal is just faster replication.
By design you're supposed to call .dump()
from the server-side (in a Node.js process) and then .load()
on the client-side using pouchdb-load
. The whole "memorystream" thing is only designed for very particular use cases, e.g. people who are trying to replicate between two local databases or over bluetooth or something fancy like that.
You may want to look into express-pouchdb-replication-stream.
Hello, I'm using the window.memorystream solution. and on, dest.load(stream) :
I'm having a GET call for each DOCS
This make the streaming very slow. Is there a way to get a whole bunch of docs into a single GET ?
Here is the Request of the Change :
And I'm getting a Get Call for each Docs :