Reset channel resume points on undo

--undo only cleared the reactions log, so a subsequent run kept
diffing forward from each channel's last-seen message instead of
honoring days_back, silently skipping everything already undone.
Undo now also clears channel_scan_state so the next run does a
full fresh backlog scan.
This commit is contained in:
2026-08-01 18:09:47 +02:00
parent c8359ef4bb
commit 5d3cc49af0
2 changed files with 16 additions and 1 deletions

View File

@@ -132,6 +132,16 @@ class Storage:
)
return inserted
def clear_scan_state(self) -> int:
"""Wipe all per-channel resume points. The backlog scan only ever
consults days_back on a channel's very first scan and otherwise just
diffs forward from the last-seen message, so this must be cleared
whenever reactions are undone (or days_back is widened) to force a
fresh full backlog scan instead of silently skipping everything."""
with self._lock, self._conn:
cur = self._conn.execute("DELETE FROM channel_scan_state")
return cur.rowcount
def get_scan_state(self, channel_id) -> Optional[dict]:
with self._lock:
cur = self._conn.execute(