Review fixes.

Revert promises back to old style.
pull/165/head
Mikunj 7 years ago
parent 594a815069
commit 174f8747b6

@ -253,6 +253,7 @@
if (!this.p2pListenersSet) { if (!this.p2pListenersSet) {
lokiP2pAPI.on('online', this._handleOnline.bind(this)); lokiP2pAPI.on('online', this._handleOnline.bind(this));
lokiP2pAPI.on('offline', this._handleOffline.bind(this)); lokiP2pAPI.on('offline', this._handleOffline.bind(this));
this.p2pListenersSet = true;
} }
if (conversations.length) { if (conversations.length) {
@ -270,14 +271,12 @@
this._initialFetchComplete = true; this._initialFetchComplete = true;
const promises = []; const promises = [];
conversations.forEach(conversation => { conversations.forEach(conversation => {
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);

@ -689,7 +689,7 @@ async function getConversationCount() {
} }
async function saveConversation(data) { async function saveConversation(data) {
const cleaned = omit(data, 'isOnine'); const cleaned = omit(data, 'isOnline');
await channels.saveConversation(cleaned); await channels.saveConversation(cleaned);
} }

Loading…
Cancel
Save