Fix up possible database write issue.

pull/165/head
Mikunj 6 years ago
parent f4e9bc655a
commit 8526c6dd92

@ -270,13 +270,14 @@
this._initialFetchComplete = true; this._initialFetchComplete = true;
const promises = []; const promises = [];
conversations.forEach(conversation => { conversations.forEach(conversation => {
// TODO This needs to be synchronous (one after the other) promises.push(async () => {
promises.concat([ // We need to await each one as
conversation.updateLastMessage(), // we don't want to simultaneously call writes on the sql database
conversation.updateProfile(), await conversation.updateLastMessage();
conversation.updateProfileAvatar(), await conversation.updateProfile();
conversation.resetPendingSend(), await conversation.updateProfileAvatar();
]); await conversation.resetPendingSend();
});
}); });
await Promise.all(promises); await Promise.all(promises);

Loading…
Cancel
Save