Revert "Process read syncs after batches of messages"

This reverts commit eccace481b.
This commit is contained in:
Fedor Indutny 2021-08-02 15:47:33 -07:00 committed by GitHub
parent 6637fc2b95
commit c5de4c6284
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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
@ -3785,43 +3778,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().onSync(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().onSync(receipt);
}
async function onVerified(ev: VerifiedEvent) {