Partially revert "Speed up bulk conversation creation"

This commit is contained in:
Fedor Indutny 2023-02-17 12:31:07 -08:00 committed by GitHub
parent b0eef98d13
commit 485bca6be9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1182,30 +1182,11 @@ export async function startApp(): Promise<void> {
onConversationClosed(id, 'removed');
conversationRemoved(id);
});
const addedConvoBatcher = createBatcher<ConversationModel>({
name: 'addedConvoBatcher',
processBatch(batch) {
batchDispatch(() => {
batch.forEach(conversation => {
conversationAdded(conversation.id, conversation.format());
});
});
},
// This delay ensures that the .format() call isn't synchronous as a
// Backbone property is changed. Important because our _byUuid/_byE164
// lookups aren't up-to-date as the change happens; just a little bit
// after.
wait: 1,
maxSize: Infinity,
});
convoCollection.on('add', conversation => {
if (!conversation) {
return;
}
addedConvoBatcher.add(conversation);
conversationAdded(conversation.id, conversation.format());
});
const changedConvoBatcher = createBatcher<ConversationModel>({