Files
quik/domain
octoshrimpy 1394e6e5a2 perf(reactions): bound reaction target search and bulk reparse
Fixes the ANR in #840, reported as "parsing emoji reactions" hanging after a
first sync. Three costs compounded, all inside a single Realm transaction:

- The bulk reparse cleared isEmojiReaction by walking every message in the
  database and writing the field whether or not it was set. Query the flagged
  messages instead, which on a typical history is a handful rather than tens of
  thousands.

- findTargetMessage loaded every message in the thread and ran a regex over each
  one, and it runs once per reaction. That product is quadratic across an
  imported history. Bound it: a reaction can only target a message that already
  existed, so filter by date, and cap the scan at the 200 most recent
  candidates. A reaction refers to something the sender can still see, so a
  target further back is not plausible.

- An untruncated quote, the common case, now matches natively in Realm on the
  body column instead of materialising each candidate's text through getText(),
  which walks MMS parts. MMS still falls through to the scan, since its text
  lives in parts rather than body.

The date filter allows a minute of slack, because clock differences between two
devices can timestamp a reaction fractionally before the message it targets.

Also fixes the progress bar, which counted only messages that turned out to be
reactions while max counted every message examined. Progress could therefore
never reach max, so the bar never completed and the final callback never fired.

reactionDate is optional on the interface so existing callers keep compiling;
all three in-tree callers now pass it.
2026-08-01 14:49:00 -04:00
..
2026-01-12 01:48:12 -05:00