From bfa22eed1abadda9f37518045e896a4090d3372e Mon Sep 17 00:00:00 2001 From: Dan Mills Date: Thu, 26 Feb 2009 17:31:06 -0800 Subject: [PATCH] Bug 480461: skip items that cannot be decrypted --- services/sync/modules/engines.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/services/sync/modules/engines.js b/services/sync/modules/engines.js index b34eca6847b..0e7d4a6f00f 100644 --- a/services/sync/modules/engines.js +++ b/services/sync/modules/engines.js @@ -291,23 +291,24 @@ SyncEngine.prototype = { let item; let count = {applied: 0, reconciled: 0}; this._lastSyncTmp = 0; + while ((item = yield newitems.iter.next(self.cb))) { this._lowMemCheck(); try { - yield item.decrypt(self.cb, ID.get('WeaveCryptoID').password); + yield item.decrypt(self.cb, ID.get('WeaveCryptoID').password); + if (yield this._reconcile.async(this, self.cb, item)) { + count.applied++; + yield this._applyIncoming.async(this, self.cb, item); + } else { + count.reconciled++; + this._log.trace("Skipping reconciled incoming item " + item.id); + if (this._lastSyncTmp < item.modified) + this._lastSyncTmp = item.modified; + } } catch (e) { - this._log.error("Could not decrypt incoming record: " + + this._log.error("Could not process incoming record: " + Utils.exceptionStr(e)); } - if (yield this._reconcile.async(this, self.cb, item)) { - count.applied++; - yield this._applyIncoming.async(this, self.cb, item); - } else { - count.reconciled++; - this._log.trace("Skipping reconciled incoming item " + item.id); - if (this._lastSyncTmp < item.modified) - this._lastSyncTmp = item.modified; - } } if (this.lastSync < this._lastSyncTmp) this.lastSync = this._lastSyncTmp;