whole process
This commit is contained in:
@@ -750,6 +750,28 @@ def remove_sqlite_database_files(settings: Settings) -> None:
|
||||
pass
|
||||
|
||||
|
||||
def reset_delivery_client_progress(settings: Settings) -> None:
|
||||
"""仅重置客户端投递游标(保留历史快照与 watch 缓存)。"""
|
||||
init_db(settings)
|
||||
conn = _connect(settings.sqlite_path)
|
||||
try:
|
||||
# 清空所有客户端游标,避免沿用旧 client_id 的消费进度。
|
||||
conn.execute("UPDATE delivery_client_cursor SET last_delivered_id = 0")
|
||||
# 确保默认客户端行存在(历史库升级场景)。
|
||||
for kind in ("measure", "health"):
|
||||
conn.execute(
|
||||
"""
|
||||
INSERT INTO delivery_client_cursor (client_id, kind, last_delivered_id)
|
||||
VALUES (?, ?, 0)
|
||||
ON CONFLICT(client_id, kind) DO NOTHING
|
||||
""",
|
||||
(DEFAULT_CLIENT_ID, kind),
|
||||
)
|
||||
conn.commit()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def clear_watch_cache_and_snapshots(settings: Settings) -> None:
|
||||
"""清空 watch 已处理路径与对应快照,便于重新跑推理(与 measure/action_watch 的 use_state_file 开关一致)。"""
|
||||
init_db(settings)
|
||||
|
||||
Reference in New Issue
Block a user