disable tracker for entire sync run. make sure tracker is re-enabled at the end

This commit is contained in:
Dan Mills 2008-12-05 00:55:19 -08:00
parent 912dadd022
commit 95b8e357b2
2 changed files with 24 additions and 17 deletions

View File

@ -347,7 +347,7 @@ SyncEngine.prototype = {
}
},
_changeRecordID: function SyncEngine__changeRecordID(oldID, newID) {
_changeItemID: function SyncEngine__changeItemID(oldID, newID) {
let self = yield;
throw "_changeRecordID must be overridden in a subclass";
},
@ -390,6 +390,8 @@ SyncEngine.prototype = {
meta.generateIV();
yield meta.addUnwrappedKey(self.cb, pubkey, symkey);
yield meta.put(self.cb);
this._tracker.disable();
}
},
@ -522,14 +524,12 @@ SyncEngine.prototype = {
let self = yield;
if (this.incoming.length) {
this._log.debug("Applying server changes");
this._tracker.disable();
let inc;
while ((inc = this.incoming.shift())) {
yield this._store.applyIncoming(self.cb, inc);
if (inc.modified > this.lastSync)
this.lastSync = inc.modified;
}
this._tracker.enable();
}
},
@ -557,11 +557,13 @@ SyncEngine.prototype = {
let self = yield;
this._log.debug("Finishing up sync");
this._tracker.resetScore();
this._tracker.enable();
},
_sync: function SyncEngine__sync() {
let self = yield;
try {
yield this._syncStartup.async(this, self.cb);
// Populate incoming and outgoing queues
@ -575,8 +577,13 @@ SyncEngine.prototype = {
// Apply incoming records, upload outgoing records
yield this._applyIncoming.async(this, self.cb);
yield this._uploadOutgoing.async(this, self.cb);
}
catch (e) {
throw e;
}
finally {
yield this._syncFinish.async(this, self.cb);
}
},
_resetServer: function SyncEngine__resetServer() {

View File

@ -785,9 +785,9 @@ BookmarksEngine.prototype = {
}
},
_changeRecordID: function BmkEngine__changeRecordID(oldID, newID) {
_changeItemID: function BmkEngine__changeRecordID(oldID, newID) {
let self = yield;
yield this._store._changeRecordID.async(this._store, self.cb, oldID, newID);
yield this._store._changeItemID.async(this._store, self.cb, oldID, newID);
}
// XXX for sharing, will need to re-add code to get new shares before syncing,