fix(email): fix misleading comment and simplify uid eviction

This commit is contained in:
Re-bin
2026-02-22 15:48:49 +00:00
parent d82c292c99
commit 4e8c8cc227

View File

@@ -304,9 +304,8 @@ class EmailChannel(BaseChannel):
self._processed_uids.add(uid) self._processed_uids.add(uid)
# mark_seen is the primary dedup; this set is a safety net # mark_seen is the primary dedup; this set is a safety net
if len(self._processed_uids) > self._MAX_PROCESSED_UIDS: if len(self._processed_uids) > self._MAX_PROCESSED_UIDS:
# Evict oldest half instead of clearing entirely # Evict a random half to cap memory; mark_seen is the primary dedup
to_keep = list(self._processed_uids)[len(self._processed_uids) // 2:] self._processed_uids = set(list(self._processed_uids)[len(self._processed_uids) // 2:])
self._processed_uids = set(to_keep)
if mark_seen: if mark_seen:
client.store(imap_id, "+FLAGS", "\\Seen") client.store(imap_id, "+FLAGS", "\\Seen")