Message Send Log: Increase retention length

This commit is contained in:
Scott Nonnenberg 2021-08-05 17:17:23 -07:00 committed by GitHub
parent 12d2b1bf7c
commit 5069f48cf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 11 deletions

View file

@ -1030,9 +1030,24 @@ export async function startApp(): Promise<void> {
const now = Date.now();
const HOUR = 1000 * 60 * 60;
const DAY = 24 * HOUR;
const oneDayAgo = now - DAY;
let sentProtoMaxAge = 14 * DAY;
try {
await window.Signal.Data.deleteSentProtosOlderThan(oneDayAgo);
sentProtoMaxAge = parseIntOrThrow(
window.Signal.RemoteConfig.getValue('desktop.retryRespondMaxAge'),
'retryRespondMaxAge'
);
} catch (error) {
window.log.warn(
'background/setInterval: Failed to parse integer from desktop.retryRespondMaxAge feature flag',
error && error.stack ? error.stack : error
);
}
try {
await window.Signal.Data.deleteSentProtosOlderThan(
now - sentProtoMaxAge
);
} catch (error) {
window.log.error(
'background/onready/setInterval: Error deleting sent protos: ',

View file

@ -1203,7 +1203,10 @@ export class ConversationModel extends window.Backbone
const { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
const sendOptions = await getSendOptions(this.attributes);
const sendOptions = {
...(await getSendOptions(this.attributes)),
online: true,
};
if (isDirectConversation(this.attributes)) {
handleMessageSend(
window.textsecure.messaging.sendMessageProtoAndWait({
@ -1212,10 +1215,7 @@ export class ConversationModel extends window.Backbone
proto: contentMessage,
contentHint: ContentHint.IMPLICIT,
groupId: undefined,
options: {
...sendOptions,
online: true,
},
options: sendOptions,
}),
{ messageIds: [], sendType: 'typing' }
);

View file

@ -1882,12 +1882,12 @@ export default class MessageSender {
const ourUuid = window.textsecure.storage.user.getUuid();
if (!ourUuid) {
throw new Error(
'sendSenderKeyDistributionMessage: Failed to fetch our UUID!'
'getSenderKeyDistributionMessage: Failed to fetch our UUID!'
);
}
const ourDeviceId = parseIntOrThrow(
window.textsecure.storage.user.getDeviceId(),
'sendSenderKeyDistributionMessage'
'getSenderKeyDistributionMessage'
);
const protocolAddress = ProtocolAddress.new(ourUuid, ourDeviceId);

View file

@ -56,8 +56,8 @@ export async function onRetryRequest(event: RetryRequestEvent): Promise<void> {
}
const HOUR = 60 * 60 * 1000;
const ONE_DAY = 24 * HOUR;
let retryRespondMaxAge = ONE_DAY;
const DAY = 24 * HOUR;
let retryRespondMaxAge = 14 * DAY;
try {
retryRespondMaxAge = parseIntOrThrow(
RemoteConfig.getValue('desktop.retryRespondMaxAge'),