Resolve conflicts in series

Attempting to resolve outgoing conflicts in parallel triggers multiple
requests for new keys from the server and causes it to return a 500
error.
This commit is contained in:
lilia 2015-07-31 17:20:33 -07:00
parent f3f084398f
commit 3e73f8f0ba
2 changed files with 6 additions and 1 deletions

View file

@ -273,11 +273,15 @@
return textsecure.storage.axolotl.removeIdentityKey(number).then(function() {
return textsecure.storage.axolotl.putIdentityKey(number, identityKey).then(function() {
var promise = Promise.resolve();
this.messageCollection.each(function(message) {
if (message.hasKeyConflict(number)) {
message.resolveConflict(number);
promise = promise.then(function() {
return message.resolveConflict(number);
});
}
});
return promise;
}.bind(this));
}.bind(this));
},

View file

@ -121,6 +121,7 @@
this.save({sent: true, errors: errors});
}.bind(this));
}
return promise;
}
},
handleDataMessage: function(dataMessage) {