Refactor contact sync processing

This commit is contained in:
Fedor Indutny 2022-08-24 22:04:42 -07:00 committed by GitHub
parent 76e73f63dc
commit 7ce4beb270
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 229 additions and 156 deletions

View file

@ -6,6 +6,7 @@
import { ipcRenderer as ipc } from 'electron';
import fs from 'fs-extra';
import pify from 'pify';
import PQueue from 'p-queue';
import {
compact,
@ -1490,7 +1491,7 @@ async function removeAllMessagesInConversation(
log.info(`removeAllMessagesInConversation/${logId}: Cleanup...`);
// Note: It's very important that these models are fully hydrated because
// we need to delete all associated on-disk files along with the database delete.
const queue = new window.PQueue({ concurrency: 3, timeout: MINUTE * 30 });
const queue = new PQueue({ concurrency: 3, timeout: MINUTE * 30 });
queue.addAll(
messages.map(
(message: MessageType) => async () => cleanupMessage(message)