fix(email): fix misleading comment and simplify uid eviction
This commit is contained in:
@@ -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")
|
||||||
|
|||||||
Reference in New Issue
Block a user