Revert "Process read syncs after batches of messages"

This reverts commit 8d49a6a8c5.
This commit is contained in:
Fedor Indutny 2021-08-02 16:18:22 -07:00 committed by GitHub
parent e715125d72
commit 12b10af63c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 44 deletions

View File

@ -311,12 +311,6 @@ export async function startApp(): Promise<void> {
window.Signal.Services.lightSessionResetQueue = lightSessionResetQueue;
lightSessionResetQueue.pause();
const readSyncQueue = new window.PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
});
readSyncQueue.pause();
window.Whisper.deliveryReceiptQueue = new window.PQueue({
concurrency: 1,
timeout: 1000 * 60 * 2,
@ -2484,8 +2478,6 @@ export async function startApp(): Promise<void> {
window.waitForEmptyEventQueue = waitForEmptyEventQueue;
async function onEmpty() {
window.Signal.Util.setBatchingStrategy(false);
await Promise.all([
window.waitForAllBatchers(),
window.flushAllWaitBatchers(),
@ -2504,7 +2496,6 @@ export async function startApp(): Promise<void> {
profileKeyResponseQueue.start();
lightSessionResetQueue.start();
readSyncQueue.start();
window.Whisper.deliveryReceiptQueue.start();
window.Whisper.Notifications.enable();
@ -2522,6 +2513,8 @@ export async function startApp(): Promise<void> {
);
}
window.Signal.Util.setBatchingStrategy(false);
const attachmentDownloadQueue = window.attachmentDownloadQueue || [];
// NOTE: ts/models/messages.ts expects this global to become undefined
@ -3784,43 +3777,29 @@ export async function startApp(): Promise<void> {
uuid: senderUuid,
});
if (readSyncQueue.isPaused) {
window.log.info(
'delaying processing of read sync',
sender,
senderUuid,
envelopeTimestamp,
senderId,
'for message',
timestamp
);
}
window.log.info(
'read sync',
sender,
senderUuid,
envelopeTimestamp,
senderId,
'for message',
timestamp
);
readSyncQueue.add(() => {
window.log.info(
'read sync',
sender,
senderUuid,
envelopeTimestamp,
senderId,
'for message',
timestamp
);
const receipt = ReadSyncs.getSingleton().add({
senderId,
sender,
senderUuid,
timestamp,
readAt,
});
receipt.on('remove', ev.confirm);
// Note: Here we wait, because we want read states to be in the database
// before we move on.
return ReadSyncs.getSingleton().onReceipt(receipt);
const receipt = ReadSyncs.getSingleton().add({
senderId,
sender,
senderUuid,
timestamp,
readAt,
});
receipt.on('remove', ev.confirm);
// Note: Here we wait, because we want read states to be in the database
// before we move on.
return ReadSyncs.getSingleton().onReceipt(receipt);
}
async function onVerified(ev: VerifiedEvent) {