Don't create an unnecessary array in conversation batcher

This commit is contained in:
Evan Hahn 2021-04-26 13:11:30 -05:00 committed by Scott Nonnenberg
parent 805eab6878
commit e77dcf7f85

View file

@ -879,10 +879,10 @@ export async function startApp(): Promise<void> {
const changedConvoBatcher = createBatcher<ConversationModel>({ const changedConvoBatcher = createBatcher<ConversationModel>({
name: 'changedConvoBatcher', name: 'changedConvoBatcher',
processBatch(batch) { processBatch(batch) {
const deduped = Array.from(new Set(batch)); const deduped = new Set(batch);
window.log.info( window.log.info(
'changedConvoBatcher: deduped ' + 'changedConvoBatcher: deduped ' +
`${batch.length} into ${deduped.length}` `${batch.length} into ${deduped.size}`
); );
deduped.forEach(conversation => { deduped.forEach(conversation => {