mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-30 14:56:01 +00:00
fix(email): fix misleading comment and simplify uid eviction
This commit is contained in:
parent
d82c292c99
commit
4e8c8cc227
@ -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")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user