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 now = Date.now();
const HOUR = 1000 * 60 * 60; const HOUR = 1000 * 60 * 60;
const DAY = 24 * HOUR; const DAY = 24 * HOUR;
const oneDayAgo = now - DAY; let sentProtoMaxAge = 14 * DAY;
try { 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) { } catch (error) {
window.log.error( window.log.error(
'background/onready/setInterval: Error deleting sent protos: ', '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 { ContentHint } = Proto.UnidentifiedSenderMessage.Message;
const sendOptions = await getSendOptions(this.attributes); const sendOptions = {
...(await getSendOptions(this.attributes)),
online: true,
};
if (isDirectConversation(this.attributes)) { if (isDirectConversation(this.attributes)) {
handleMessageSend( handleMessageSend(
window.textsecure.messaging.sendMessageProtoAndWait({ window.textsecure.messaging.sendMessageProtoAndWait({
@ -1212,10 +1215,7 @@ export class ConversationModel extends window.Backbone
proto: contentMessage, proto: contentMessage,
contentHint: ContentHint.IMPLICIT, contentHint: ContentHint.IMPLICIT,
groupId: undefined, groupId: undefined,
options: { options: sendOptions,
...sendOptions,
online: true,
},
}), }),
{ messageIds: [], sendType: 'typing' } { messageIds: [], sendType: 'typing' }
); );

View file

@ -1882,12 +1882,12 @@ export default class MessageSender {
const ourUuid = window.textsecure.storage.user.getUuid(); const ourUuid = window.textsecure.storage.user.getUuid();
if (!ourUuid) { if (!ourUuid) {
throw new Error( throw new Error(
'sendSenderKeyDistributionMessage: Failed to fetch our UUID!' 'getSenderKeyDistributionMessage: Failed to fetch our UUID!'
); );
} }
const ourDeviceId = parseIntOrThrow( const ourDeviceId = parseIntOrThrow(
window.textsecure.storage.user.getDeviceId(), window.textsecure.storage.user.getDeviceId(),
'sendSenderKeyDistributionMessage' 'getSenderKeyDistributionMessage'
); );
const protocolAddress = ProtocolAddress.new(ourUuid, ourDeviceId); 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 HOUR = 60 * 60 * 1000;
const ONE_DAY = 24 * HOUR; const DAY = 24 * HOUR;
let retryRespondMaxAge = ONE_DAY; let retryRespondMaxAge = 14 * DAY;
try { try {
retryRespondMaxAge = parseIntOrThrow( retryRespondMaxAge = parseIntOrThrow(
RemoteConfig.getValue('desktop.retryRespondMaxAge'), RemoteConfig.getValue('desktop.retryRespondMaxAge'),