serve 设为只读模式,禁用外部数据拉取
serve 端不再启动 pull_scheduler 和 financial_scheduler, 阻塞 ext_data 和 financials 的外部获取/同步 API 端点, 数据仅通过 local→serve 同步推送。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -98,27 +98,8 @@ def get_cash_flow(request: Request, symbol: str | None = None):
|
||||
|
||||
@router.post("/sync/{table}")
|
||||
def sync_table(request: Request, table: str):
|
||||
"""手动触发同步(立即返回,后台异步执行)。
|
||||
|
||||
table: metrics / income / balance_sheet / cash_flow / all
|
||||
同步在后台线程执行,全量同步需数分钟。本接口立即返回 started 状态,
|
||||
前端通过轮询 GET /status 的 syncing 字段观察进度。
|
||||
"""
|
||||
capset = request.app.state.capabilities
|
||||
capset.require(Cap.FINANCIAL)
|
||||
|
||||
valid_tables = {"metrics", "income", "balance_sheet", "cash_flow", "all"}
|
||||
if table not in valid_tables:
|
||||
raise HTTPException(400, f"invalid table: {table}, expected one of {valid_tables}")
|
||||
|
||||
fs = getattr(request.app.state, "financial_scheduler", None)
|
||||
if not fs:
|
||||
return {"status": "error", "message": "FinancialScheduler not available"}
|
||||
|
||||
target = None if table == "all" else table
|
||||
result = fs.trigger(target)
|
||||
|
||||
return {"status": "ok", "synced": result}
|
||||
"""手动触发同步 — serve 端为只读模式,已禁用。"""
|
||||
raise HTTPException(403, "serve 端为只读模式,数据仅通过 local→serve 同步")
|
||||
|
||||
|
||||
class AnalyzeRequest(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user