Don't re-write the message cache while we're processing it.

This commit is contained in:
Ian Gulliver
2016-01-05 19:12:57 -08:00
parent 59fab5e3c6
commit 77227df9aa

View File

@@ -344,9 +344,11 @@ Cosmopolite.prototype.subscribe = function(subjects, opt_messages, opt_lastID) {
var messageStr = localStorage[key];
if (messageStr) {
var messages = JSON.parse(messageStr);
subscription.use_cache = false;
messages.forEach(function(msg) {
msg['message'] = JSON.stringify(msg['message']);
this.onMessage_(msg);
subscription.use_cache = true;
}.bind(this));
}
if (subscription.messages.length > 0) {