refactor(outlook): 简化为单 IMAP_NEW Provider

This commit is contained in:
cnlimiter
2026-03-21 01:34:49 +08:00
committed by Mison
parent 188636356a
commit 668500028a
18 changed files with 732 additions and 1607 deletions

View File

@@ -340,6 +340,7 @@ def _run_sync_registration_task(task_uuid: str, email_service_type: str, proxy:
if selected_service and selected_service.config:
config = selected_service.config.copy()
config['service_id'] = selected_service.id
crud.update_registration_task(db, task_uuid, email_service_id=selected_service.id)
logger.info(f"使用数据库 Outlook 账户: {selected_service.name}")
else:

View File

@@ -705,7 +705,6 @@ async def get_outlook_settings():
return {
"default_client_id": settings.outlook_default_client_id,
"provider_priority": settings.outlook_provider_priority,
"health_failure_threshold": settings.outlook_health_failure_threshold,
"health_disable_duration": settings.outlook_health_disable_duration,
}

View File

@@ -191,13 +191,23 @@ class TaskManager:
return _log_queues.get(task_uuid, []).copy()
def update_status(self, task_uuid: str, status: str, **kwargs):
"""更新任务状态"""
"""更新任务状态并推送到 WebSocket"""
if task_uuid not in _task_status:
_task_status[task_uuid] = {}
_task_status[task_uuid]["status"] = status
_task_status[task_uuid].update(kwargs)
# 推送状态变更到 WebSocket线程安全兼容同步线程调用
if self._loop and self._loop.is_running():
try:
asyncio.run_coroutine_threadsafe(
self.broadcast_status(task_uuid, status, **kwargs),
self._loop
)
except Exception as e:
logger.warning(f"推送状态到 WebSocket 失败: {e}")
def get_status(self, task_uuid: str) -> Optional[dict]:
"""获取任务状态"""
return _task_status.get(task_uuid)