检查服务状态
()
| 376 | |
| 377 | @app.route("/status", methods=["GET", "POST"]) |
| 378 | def service_status(): |
| 379 | """检查服务状态""" |
| 380 | health, msg = is_server_running() |
| 381 | |
| 382 | if not health: |
| 383 | return Response(json.dumps(msg, ensure_ascii=False), status=500, content_type="application/json") |
| 384 | |
| 385 | # 检查端口是否监听 |
| 386 | ports_status = { |
| 387 | "api_port": FD_API_PORT if is_port_in_use(FD_API_PORT) else None, |
| 388 | "queue_port": FD_ENGINE_QUEUE_PORT if is_port_in_use(FD_ENGINE_QUEUE_PORT) else None, |
| 389 | "metrics_port": FD_METRICS_PORT if is_port_in_use(FD_METRICS_PORT) else None, |
| 390 | } |
| 391 | |
| 392 | msg["status"] = "服务启动完成" |
| 393 | msg["ports_status"] = ports_status |
| 394 | |
| 395 | return Response(json.dumps(msg, ensure_ascii=False), status=200, content_type="application/json") |
| 396 | |
| 397 | |
| 398 | @app.route("/stop", methods=["POST"]) |
nothing calls this directly
no test coverage detected