Compare commits

..
2 Commits
Author SHA1 Message Date
hz4th_coder efdfaecccd fix: refresh 参数支持 URL query string(原来只读JSON body, ?refresh=1 无效) 2026-09-14 13:16:51 +08:00
hz4th_coder 7c00ed2e47 v1.9.3 修复服务静默挂掉: 关debug reloader改单进程生产模式 + setsid启动脱离会话
根因: ①Flask debug reloader 主进程在 worker 意外退出后不会自动拉起, 导致主进程存活但端口无监听, 无任何日志报错(静默挂); ②openclaw exec 会话结束时清理进程组, nohup 启动的服务随会话结束被杀
修复: debug=False + use_reloader=False(单进程, threaded), 启动命令改 setsid nohup ... < /dev/null 脱离会话进程组
启动: cd works/web-capture-api && setsid nohup /home/hz1/miniconda3/envs/openclaw/bin/python3 app.py > logs/app.log 2>&1 < /dev/null & disown
2026-09-11 23:37:24 +08:00
+6 -2
View File
@@ -1649,7 +1649,9 @@ def capture():
settings = load_capture_settings()
cache_cfg = settings.get("cache", DEFAULT_CACHE_CONFIG)
retry_cfg = settings.get("retry", DEFAULT_RETRY_CONFIG)
force_refresh = bool(data.get("refresh") or data.get("force"))
force_refresh = bool(data.get("refresh") or data.get("force")) or \
str(request.args.get("refresh") or "").lower() in ("1", "true", "yes") or \
str(request.args.get("force") or "").lower() in ("1", "true", "yes")
# per-request 缓存参数:cache_ttl_seconds=本次缓存时效(秒, -1=永久, 覆盖全局)cache=false / no_cache=true=本次禁用缓存
no_cache = data.get("cache") is False or str(data.get("no_cache")).lower() in ("true", "1", "yes")
try:
@@ -1777,4 +1779,6 @@ if __name__ == '__main__':
print(" playwright: pip install playwright && playwright install chromium")
print("\n🚀 Server running on http://0.0.0.0:16025")
app.run(host='0.0.0.0', port=16025, debug=True)
# 生产模式:不启用 debug reloaderreloader 主进程在 worker 意外退出后不会自动拉起,
# 曾导致服务静默挂掉),改代码后需手动重启:kill 进程后 nohup 重新启动
app.run(host='0.0.0.0', port=16025, debug=False, use_reloader=False, threaded=True)