fix: skip already-processing UIDs at FETCH level to avoid downloading email content
This commit is contained in:
@@ -8,11 +8,11 @@ from src.tg_bot import send_summary, send_thinking, edit_message, format_summary
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def poll_accounts(cfg: Config) -> Generator[tuple[int, Email], None, None]:
|
||||
def poll_accounts(cfg: Config, skip_uids: set[bytes] | None = None) -> Generator[tuple[int, Email], None, None]:
|
||||
for idx, acct in enumerate(cfg.email_accounts):
|
||||
try:
|
||||
logger.info(f"检查邮箱: {acct.username}")
|
||||
emails = fetch_unseen_emails(acct)
|
||||
emails = fetch_unseen_emails(acct, skip_uids=skip_uids)
|
||||
if emails:
|
||||
logger.info(f" 发现 {len(emails)} 封新邮件")
|
||||
for mail in emails:
|
||||
|
||||
Reference in New Issue
Block a user