From a688690f1519f2ef94691157ab48320fc3f95a75 Mon Sep 17 00:00:00 2001 From: shy3130 <415333856@qq.com> Date: Tue, 7 Jul 2026 11:10:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9B=98=E5=89=8D=E7=BB=B4=E8=A1=A8?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E5=90=8E=E5=88=B7=E6=96=B0=20enriched=20?= =?UTF-8?q?=E7=BC=93=E5=AD=98,=20=E4=BF=AE=E5=A4=8D=E8=B7=A8=E5=A4=A9?= =?UTF-8?q?=E8=BF=9E=E6=9D=BF=E6=A2=AF=E9=98=9F=E4=B8=8D=E5=87=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因: 服务跨天不重启时, enriched 内存缓存残留前一交易日数据, 连板梯队/ 选股读到旧的涨跌停信号。盘前维表 (instruments) 含当日精确涨跌停价, 但同步 完成后未触发缓存重建。 修复: run_instruments_sync 完成后 (rows > 0), 执行 clear_cache + refresh_cache, 让 enriched 缓存基于最新维表 (含当日 limit_up/down) 重建。与设置页「清理并刷新」 按钮同等效果, 但盘前自动执行, 无需手动操作。 --- backend/app/jobs/daily_pipeline.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/app/jobs/daily_pipeline.py b/backend/app/jobs/daily_pipeline.py index d722f84..817dae4 100644 --- a/backend/app/jobs/daily_pipeline.py +++ b/backend/app/jobs/daily_pipeline.py @@ -69,10 +69,18 @@ def _resolve_universe(capset: CapabilitySet) -> list[str]: def run_instruments_sync(repo: KlineRepository) -> dict: - """盘前同步个股维表。""" + """盘前同步个股维表。 + + 维表含当日涨跌停价 (limit_up/down), 同步完成后刷新 enriched 内存缓存, + 确保跨天后连板梯队/选股等读到的是基于最新维表的数据 (而非前一交易日残留)。 + """ rows = instrument_sync.sync_instruments(repo.store.data_dir) _refresh_instruments_view(repo) _invalidate("instruments") + # 维表更新后重建 enriched 缓存 (clear + refresh, 与设置页「清理并刷新」同等效果) + if rows > 0: + repo.clear_cache() + repo.refresh_cache() return {"instruments_rows": rows}