Retry outbound "normal" messages for up to a day

This commit is contained in:
Evan Hahn 2021-08-31 15:58:39 -05:00 committed by GitHub
parent 62cf51c060
commit a85dd1be36
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 1414 additions and 603 deletions

View file

@ -40,6 +40,7 @@ import {
MessageModelCollectionType,
} from '../model-types.d';
import { StoredJob } from '../jobs/types';
import { formatJobForInsert } from '../jobs/formatJobForInsert';
import {
AttachmentDownloadJobType,
@ -206,6 +207,7 @@ const dataInterface: ClientInterface = {
getMessageBySender,
getMessageById,
getMessagesById,
getAllMessageIds,
getMessagesBySentAt,
getExpiredMessages,
@ -1070,9 +1072,12 @@ async function getMessageCount(conversationId?: string) {
async function saveMessage(
data: MessageType,
options?: { forceSave?: boolean }
options: { jobToInsert?: Readonly<StoredJob>; forceSave?: boolean } = {}
) {
const id = await channels.saveMessage(_cleanMessageData(data), options);
const id = await channels.saveMessage(_cleanMessageData(data), {
...options,
jobToInsert: options.jobToInsert && formatJobForInsert(options.jobToInsert),
});
window.Whisper.ExpiringMessagesListener.update();
window.Whisper.TapToViewMessagesListener.update();
@ -1124,6 +1129,13 @@ async function getMessageById(
return new Message(message);
}
async function getMessagesById(messageIds: Array<string>) {
if (!messageIds.length) {
return [];
}
return channels.getMessagesById(messageIds);
}
// For testing only
async function _getAllMessages({
MessageCollection,