Don't re-write the message cache while we're processing it.
This commit is contained in:
@@ -344,9 +344,11 @@ Cosmopolite.prototype.subscribe = function(subjects, opt_messages, opt_lastID) {
|
|||||||
var messageStr = localStorage[key];
|
var messageStr = localStorage[key];
|
||||||
if (messageStr) {
|
if (messageStr) {
|
||||||
var messages = JSON.parse(messageStr);
|
var messages = JSON.parse(messageStr);
|
||||||
|
subscription.use_cache = false;
|
||||||
messages.forEach(function(msg) {
|
messages.forEach(function(msg) {
|
||||||
msg['message'] = JSON.stringify(msg['message']);
|
msg['message'] = JSON.stringify(msg['message']);
|
||||||
this.onMessage_(msg);
|
this.onMessage_(msg);
|
||||||
|
subscription.use_cache = true;
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
if (subscription.messages.length > 0) {
|
if (subscription.messages.length > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user