Two-phase backlog scan with self-healing found-count tracking
Split each channel's backlog scan into a find phase (settles the found count first) and a react phase, so the progress display no longer grows both numbers in lockstep. Found messages are logged in a dedicated, message_id-deduped table and recovered across restarts independent of the resume checkpoint, so nothing found is silently abandoned if the script stops mid-react. Also drops the separately-maintained messages_found counter, which proved prone to drift under repeated interruptions/rescans, in favor of computing it live from the dedup table - self-healing regardless of how many times a channel gets rescanned.
This commit is contained in:
@@ -44,6 +44,9 @@ async def undo_all_reactions(client: discord.Client, storage: Storage, display:
|
||||
await asyncio.sleep(human_jitter())
|
||||
|
||||
cleared = await asyncio.to_thread(storage.clear_scan_state)
|
||||
await asyncio.to_thread(storage.reset_message_counts)
|
||||
if display is not None:
|
||||
await display.refresh()
|
||||
log.info(
|
||||
"Undo complete: removed %d/%d reaction(s), cleared %d channel resume point(s) — "
|
||||
"the next normal run will do a full fresh backlog scan.",
|
||||
|
||||
Reference in New Issue
Block a user