mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-30 23:05:51 +00:00
Merge PR #959: fix(email): evict oldest half of dedup set instead of clearing entirely
This commit is contained in:
commit
60751909cb
@ -304,7 +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:
|
||||||
self._processed_uids.clear()
|
# Evict a random half to cap memory; mark_seen is the primary dedup
|
||||||
|
self._processed_uids = set(list(self._processed_uids)[len(self._processed_uids) // 2:])
|
||||||
|
|
||||||
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