Do not interrupt redact sequences because of exceptions on backfilling (#479)

This commit is contained in:
Marco Cirillo 2024-07-25 01:14:11 +02:00 committed by GitHub
parent e776d82d89
commit 1ffde55beb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,6 +86,7 @@ export async function redactUserMessagesIn(client: MatrixSendClient, managementR
for (const targetRoomId of targetRoomIds) {
await managementRoom.logMessage(LogLevel.DEBUG, "utils#redactUserMessagesIn", `Fetching sent messages for ${userIdOrGlob} in ${targetRoomId} to redact...`, targetRoomId);
try {
await getMessagesByUserIn(client, userIdOrGlob, targetRoomId, limit, async (eventsToRedact) => {
for (const targetEvent of eventsToRedact) {
await managementRoom.logMessage(LogLevel.DEBUG, "utils#redactUserMessagesIn", `Redacting ${targetEvent['event_id']} in ${targetRoomId}`, targetRoomId);
@ -96,6 +97,9 @@ export async function redactUserMessagesIn(client: MatrixSendClient, managementR
}
}
});
} catch (error) {
await managementRoom.logMessage(LogLevel.ERROR, "utils#redactUserMessagesIn", `Caught an error while trying to redact messages for ${userIdOrGlob} in ${targetRoomId}: ${error}`, targetRoomId);
}
}
}