From 0b4d14e5acf4c1a46044f53797dcff8452feabb7 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Fri, 28 Jul 2017 16:34:38 -0700 Subject: [PATCH] MessageReceiver: Ensure that we queue all cached first FREEBIE --- libtextsecure/message_receiver.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libtextsecure/message_receiver.js b/libtextsecure/message_receiver.js index 87a9d226beac..d675c8ff9171 100644 --- a/libtextsecure/message_receiver.js +++ b/libtextsecure/message_receiver.js @@ -33,9 +33,7 @@ MessageReceiver.prototype.extend({ keepalive: { path: '/v1/keepalive', disconnect: true } }); - this.pending = Promise.resolve(); - - this.queueAllCached(); + this.pending = this.queueAllCached(); }, close: function() { this.socket.close(3000, 'called close'); @@ -156,7 +154,7 @@ MessageReceiver.prototype.extend({ this.dispatchEvent(ev); }, queueAllCached: function() { - this.getAllFromCache().then(function(items) { + return this.getAllFromCache().then(function(items) { for (var i = 0, max = items.length; i < max; i += 1) { this.queueCached(items[i]); }