Log mailbox refresh failures safely
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import dataclasses
|
||||
import logging
|
||||
from types import SimpleNamespace
|
||||
from typing import Any
|
||||
|
||||
@@ -69,6 +70,7 @@ from govoplan_mail.backend.sending.imap import ImapAppendError, ImapConfiguratio
|
||||
from govoplan_mail.backend.sending.smtp import test_smtp_login
|
||||
|
||||
router = APIRouter(prefix="/mail", tags=["mail"])
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
MAIL_MODULE_ID = "mail"
|
||||
MAIL_PROFILES_COLLECTION = "mail.profiles"
|
||||
@@ -497,7 +499,12 @@ def _refresh_mailbox_index_task(
|
||||
except Exception:
|
||||
# Background refresh is opportunistic. Foreground requests will surface
|
||||
# concrete IMAP errors when no usable cache is available.
|
||||
pass
|
||||
logger.debug(
|
||||
"Background mailbox index refresh failed (profile_id=%r, folder=%r)",
|
||||
profile_id,
|
||||
folder,
|
||||
exc_info=True,
|
||||
)
|
||||
finally:
|
||||
finish_mailbox_refresh(tenant_id, profile_id, folder)
|
||||
|
||||
@@ -826,7 +833,7 @@ def write_mail_profile_policy(
|
||||
scope_type = scope_type.strip().casefold()
|
||||
_require_policy_write_scope(principal, scope_type)
|
||||
try:
|
||||
policy = set_mail_profile_policy(
|
||||
set_mail_profile_policy(
|
||||
session,
|
||||
tenant_id=principal.tenant_id,
|
||||
scope_type=scope_type,
|
||||
|
||||
Reference in New Issue
Block a user