feat: add retry(10) on all network requests

- New src/retry.py with configurable retry decorator
- Applied @retry() to fetch_unseen_emails, mark_as_seen,
  summarize_email, and send_message
- No backoff delay between retries
This commit is contained in:
2026-07-02 20:02:03 +08:00
parent 89149b506c
commit a6817d3e11
4 changed files with 36 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ from email.header import decode_header
from email.utils import parsedate_to_datetime
from typing import Optional
from src.config import EmailAccount
from src.retry import retry
class Email:
@@ -76,6 +77,7 @@ def _login_and_prepare(account: EmailAccount):
return conn
@retry()
def fetch_unseen_emails(account: EmailAccount) -> list[Email]:
conn = _login_and_prepare(account)
@@ -101,6 +103,7 @@ def fetch_unseen_emails(account: EmailAccount) -> list[Email]:
return emails
@retry()
def mark_as_seen(account: EmailAccount, uids: list[bytes]):
if not uids:
return