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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user