fix(reactions): Fix ANR when parsing many reactions

A few optimizations:
- Cap messages that will be checked by the regex to 500 messages, as the target message is more than likely in that range
- Filter by messages only before the reaction date

Co-authored-by: Inhishonor <inhishonor@protonmail.com>
This commit is contained in:
octoshrimpy
2026-09-18 18:05:52 -06:00
committed by Inhishonor
parent 3775a1948b
commit 41ac7ffe53
4 changed files with 61 additions and 16 deletions
@@ -26,7 +26,12 @@ data class ParsedEmojiReaction(val emoji: String, val originalMessage: String, v
interface EmojiReactionRepository {
fun parseEmojiReaction(body: String): ParsedEmojiReaction?
fun findTargetMessage(threadId: Long, originalMessageText: String, realm: Realm): Message?
fun findTargetMessage(
threadId: Long,
originalMessageText: String,
realm: Realm,
reactionDate: Long?,
): Message?
fun saveEmojiReaction(
reactionMessage: Message,