From ecfbb0ed4fe1ce0edcddaf196114e0c2e39778f1 Mon Sep 17 00:00:00 2001 From: chengyongru Date: Mon, 20 Apr 2026 14:50:44 +0800 Subject: [PATCH] refactor(email): use _remember_processed_uid in SPF/DKIM reject paths Replaces inline dedup logic with the existing helper to match the style of _is_self_address and other reject branches, and to keep the _processed_uids eviction logic in one place. --- nanobot/channels/email.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/nanobot/channels/email.py b/nanobot/channels/email.py index ea30a8e58..5b5856560 100644 --- a/nanobot/channels/email.py +++ b/nanobot/channels/email.py @@ -395,10 +395,7 @@ class EmailChannel(BaseChannel): "(no 'spf=pass' in Authentication-Results header)", sender, ) - if uid: - cycle_uids.add(uid) - if dedupe: - self._processed_uids.add(uid) + self._remember_processed_uid(uid, dedupe, cycle_uids) continue if self.config.verify_dkim and not dkim_pass: logger.warning( @@ -406,10 +403,7 @@ class EmailChannel(BaseChannel): "(no 'dkim=pass' in Authentication-Results header)", sender, ) - if uid: - cycle_uids.add(uid) - if dedupe: - self._processed_uids.add(uid) + self._remember_processed_uid(uid, dedupe, cycle_uids) continue subject = self._decode_header_value(parsed.get("Subject", ""))