Optimize a few queries

This commit is contained in:
Scott Nonnenberg
2021-12-20 13:04:02 -08:00
committed by GitHub
parent b08691b35b
commit 60a53656af
27 changed files with 1288 additions and 186 deletions

View File

@@ -12,7 +12,9 @@ const updateMessageBatcher = createBatcher<MessageAttributesType>({
maxSize: 50,
processBatch: async (messageAttrs: Array<MessageAttributesType>) => {
log.info('updateMessageBatcher', messageAttrs.length);
await window.Signal.Data.saveMessages(messageAttrs);
await window.Signal.Data.saveMessages(messageAttrs, {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});
},
});
@@ -22,7 +24,9 @@ export function queueUpdateMessage(messageAttr: MessageAttributesType): void {
if (shouldBatch) {
updateMessageBatcher.add(messageAttr);
} else {
window.Signal.Data.saveMessage(messageAttr);
window.Signal.Data.saveMessage(messageAttr, {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});
}
}
@@ -38,6 +42,7 @@ export const saveNewMessageBatcher = createWaitBatcher<MessageAttributesType>({
log.info('saveNewMessageBatcher', messageAttrs.length);
await window.Signal.Data.saveMessages(messageAttrs, {
forceSave: true,
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});
},
});