This commit is contained in:
2026-09-09 11:35:02 +08:00
parent bc1c72d558
commit d656c05b3d
35 changed files with 711 additions and 3194 deletions

View File

@@ -16,6 +16,7 @@ from __future__ import annotations
import asyncio
import calendar
import json
import logging
import time
from dataclasses import dataclass
from datetime import date
@@ -29,6 +30,8 @@ from ..db import async_session
from ..models import StockReference
from .sync_utils import call_retry, f_clean, fresh, get_pro_lazy, read_sync_state, s_clean, upsert_sync_state, utcnow
log = logging.getLogger(__name__)
_REFRESH_DAYS = 7
@@ -394,12 +397,12 @@ async def _sync_repurchase_locked(only_current: bool) -> dict[str, list[dict]]:
async def _repurchase_backfill() -> None:
"""后台全量回填(近 24 个月);失败静默——下次触发重试。"""
"""后台全量回填(近 24 个月);失败记录日志——下次触发重试。"""
try:
async with _repurchase_lock:
await _sync_repurchase_locked(only_current=False)
except Exception: # noqa: BLE001 后台任务无人接异常
pass
except Exception: # noqa: BLE001 后台任务无人接异常,至少留痕
log.warning("回购数据后台回填失败(下次触发重试)", exc_info=True)
def _spawn_repurchase_backfill() -> None: