From 2b328caf6d381ffa09f52671286d8a1b4c1c0b2f Mon Sep 17 00:00:00 2001 From: Felix Hammerl Date: Fri, 24 Jan 2014 15:31:40 +0100 Subject: [PATCH] [WO-217] fix downstream sync --- src/js/dao/email-dao.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/js/dao/email-dao.js b/src/js/dao/email-dao.js index 77ac962..e2b31f3 100644 --- a/src/js/dao/email-dao.js +++ b/src/js/dao/email-dao.js @@ -463,6 +463,13 @@ define(function(require) { }); } + // sync in the uids in ascending order, to not leave the local database in a corrupted state: + // when the 5, 3, 1 should be synced and the client would fail at 3, but 5 was successfully synced, + // any subsequent syncs would never fetch 1 and 3. simple solution: sync in ascending order + delta4 = _.sortBy(delta4, function(uidWrapper) { + return uidWrapper.uid; + }); + syncNextItem(); function syncNextItem() {