Add clear-and-refetch for hub K-line cache.
Force refresh wipes the series in hub_kline.db before pulling from the exchange; add a Linux clear script and rename the UI button to 清库重拉. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -675,6 +675,7 @@ def api_chart_ohlcv(
|
||||
bms = int(bms_raw)
|
||||
except ValueError:
|
||||
raise HTTPException(status_code=400, detail="before_ms 无效")
|
||||
clear_db = force and not tail_refresh and bms is None
|
||||
|
||||
def remote_fetch(**kwargs):
|
||||
tf_use = kwargs.get("timeframe") or timeframe
|
||||
@@ -693,6 +694,7 @@ def api_chart_ohlcv(
|
||||
remote_fetch,
|
||||
force_refresh=force,
|
||||
tail_refresh=tail_refresh,
|
||||
clear_db=clear_db,
|
||||
limit=lim,
|
||||
before_ms=bms,
|
||||
)
|
||||
|
||||
@@ -2648,6 +2648,7 @@
|
||||
(data.from_cache || 0) +
|
||||
" / 新拉 " +
|
||||
(data.fetched || 0) +
|
||||
(data.cleared ? " · 清库 " + data.cleared : "") +
|
||||
" · 左拖加载更多 · 后台 " +
|
||||
(data.chart_poll_interval_sec || 5) +
|
||||
"s";
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
</select>
|
||||
</label>
|
||||
<button type="button" id="market-load" class="primary">加载</button>
|
||||
<button type="button" id="market-refresh" class="ghost">强制刷新</button>
|
||||
<button type="button" id="market-refresh" class="ghost" title="清空该币种本周期 K 线缓存并从交易所重新拉取">清库重拉</button>
|
||||
<span class="toolbar-spacer"></span>
|
||||
<span id="market-bar-countdown" class="toolbar-meta market-countdown"></span>
|
||||
<span id="market-updated" class="toolbar-meta"></span>
|
||||
@@ -349,7 +349,7 @@
|
||||
|
||||
<div id="toast"></div>
|
||||
<script src="https://unpkg.com/lightweight-charts@4.2.0/dist/lightweight-charts.standalone.production.js"></script>
|
||||
<script src="/assets/chart.js?v=20260608-fetch-fix"></script>
|
||||
<script src="/assets/chart.js?v=20260608-clear-refetch"></script>
|
||||
<script src="/assets/archive.js?v=20260607-hub-archive-v6"></script>
|
||||
<script src="/assets/ai_review_render.js?v=2"></script>
|
||||
<script src="/assets/app.js?v=20260607-hub-archive-v1"></script>
|
||||
|
||||
Reference in New Issue
Block a user