Permalink
Browse files

Bug 862870. Implement splice batching with forced flushes if batching…

… too much. r=asuth
  • Loading branch information...
changm authored and asutherland committed Dec 14, 2013
1 parent 660ecbd commit 59efcdcdb9b8f632b105b35b39ebd8244a9773a9
@@ -1384,7 +1384,7 @@ ActiveSyncFolderSyncer.prototype = {
initialSync: function(slice, initialDays, syncCallback,
doneCallback, progressCallback) {
- syncCallback('sync', false, true);
+ syncCallback('sync', true /* Ignore Headers */);
this.folderConn.sync(
$date.NOW(),
this.onSyncCompleted.bind(this, doneCallback, true),
@@ -548,7 +548,6 @@ console.log('BISECT CASE', serverUIDs.length, 'curDaysDelta', curDaysDelta);
// build the list of requests based on downloading required.
var requests = [];
bodyInfo.bodyReps.forEach(function(rep, idx) {
-
// attempt to be idempotent by only requesting the bytes we need if we
// actually need them...
if (rep.isDownloaded)
@@ -961,7 +960,7 @@ ImapFolderSyncer.prototype = {
*/
initialSync: function(slice, initialDays, syncCallback,
doneCallback, progressCallback) {
- syncCallback('sync', false);
+ syncCallback('sync', false /* Ignore Headers */);
// We want to enter the folder and get the box info so we can know if we
// should trigger our SYNC_WHOLE_FOLDER_AT_N_MESSAGES logic.
// _timelySyncSearch is what will get called next either way, and it will
@@ -1090,11 +1089,7 @@ ImapFolderSyncer.prototype = {
// intended to be a new thing for each request. So we don't want extra
// desire building up, so we set it to what we have every time.
//
- // We don't want to affect this value in accumulating mode, however, since
- // it could result in sending more headers than actually requested over the
- // wire.
- if (!this._syncSlice._accumulating)
- this._syncSlice.desiredHeaders = this._syncSlice.headers.length;
+ this._syncSlice.desiredHeaders = this._syncSlice.headers.length;
if (this._curSyncDoneCallback)
this._curSyncDoneCallback(err);
@@ -1288,10 +1283,6 @@ console.log("folder message count", folderMessageCount,
this._doneSync();
return;
}
- else if (this._syncSlice._accumulating) {
- // flush the accumulated results thus far
- this._syncSlice.setStatus('synchronizing', true, true, true);
- }
// - Increase our search window size if we aren't finding anything
// Our goal is that if we are going backwards in time and aren't finding
@@ -382,7 +382,6 @@ exports.chewHeaderAndBodyStructure =
*
*/
exports.updateMessageWithFetch = function(header, body, req, res, _LOG) {
-
var bodyRep = body.bodyReps[req.bodyRepIndex];
// check if the request was unbounded or we got back less bytes then we
@@ -142,9 +142,18 @@ Sync.prototype = {
if (!self.oncomplete)
return;
- self.oncomplete(
- self.newUIDs.length,
- self.knownUIDs.length
+ // Need a timeout here
+ // because we batch slices in SliceBridgeProxy
+ // And only want to call oncomplete after
+ // All those slices have been sent to keep the order
+ // the same
+ setZeroTimeout(
+ function() {
+ self.oncomplete(
+ self.newUIDs.length,
+ self.knownUIDs.length
+ );
+ }
);
});
}
Oops, something went wrong.

0 comments on commit 59efcdc

Please sign in to comment.