Skip to content

Commit d846928

Browse files
committed
update health
1 parent 1424f7c commit d846928

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lightllm/server/api_http.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@ async def healthcheck(request: Request):
142142
return JSONResponse({"message": "Error"}, status_code=503)
143143
from lightllm.utils.health_check import health_check, health_obj
144144

145-
asyncio.create_task(health_check(g_objs.args, g_objs.httpserver_manager, None))
146-
if health_obj.is_health():
147-
return JSONResponse({"message": "Ok"}, status_code=200)
148-
else:
149-
return JSONResponse({"message": "Error"}, status_code=503)
145+
health_task = asyncio.create_task(health_check(g_objs.args, g_objs.httpserver_manager, None))
146+
if not health_obj.is_health():
147+
await health_task
148+
return JSONResponse(
149+
{"message": "Ok" if health_obj.is_health() else "Error"}, status_code=200 if health_obj.is_health() else 503
150+
)
150151

151152

152153
@app.get("/token_load", summary="Get the current server's load of tokens")

0 commit comments

Comments
 (0)