loadAndScroll: Use one transaction to pull all data: old/new/metrics

This commit is contained in:
Scott Nonnenberg 2021-12-20 13:05:13 -08:00 committed by GitHub
parent 60a53656af
commit 0163ef203b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 132 additions and 16 deletions

View file

@ -240,6 +240,7 @@ const dataInterface: ClientInterface = {
getOlderStories,
getNewerMessagesByConversation,
getMessageMetricsForConversation,
getConversationRangeCenteredOnMessage,
getLastConversationMessages,
hasGroupCallHistoryMessage,
migrateConversationMessages,
@ -1318,6 +1319,23 @@ async function getMessageMetricsForConversation(
return result;
}
async function getConversationRangeCenteredOnMessage(options: {
conversationId: string;
limit?: number;
messageId: string;
receivedAt: number;
sentAt?: number;
storyId?: UUIDStringType;
}) {
const result = await channels.getConversationRangeCenteredOnMessage(options);
return {
...result,
older: handleMessageJSON(result.older),
newer: handleMessageJSON(result.newer),
};
}
function hasGroupCallHistoryMessage(
conversationId: string,
eraId: string