|
|
|
@ -654,7 +654,7 @@ async def set_sovits_weights(weights_path: str = None):
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
|
|
# 启动服务器中(状态修改为1)
|
|
|
|
|
set_status(db_path, 1)
|
|
|
|
|
|
|
|
|
|
if host == "None": # 在调用时使用 -a None 参数,可以让api监听双栈
|
|
|
|
@ -664,14 +664,19 @@ if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
if not check_port(port):
|
|
|
|
|
print(f"端口 {port} 已被占用,无法启动服务。")
|
|
|
|
|
set_status(db_path, 3) # 更新状态为启动失败
|
|
|
|
|
# 端口被占用,启动服务器失败(状态修改为3)
|
|
|
|
|
set_status(db_path, 3)
|
|
|
|
|
exit(1)
|
|
|
|
|
|
|
|
|
|
# 启动服务器成功(状态修改为2)
|
|
|
|
|
set_status(db_path, 2)
|
|
|
|
|
|
|
|
|
|
# 再启动服务器(这是一个阻塞调用)
|
|
|
|
|
uvicorn.run(app=APP, host=host, port=port, workers=1)
|
|
|
|
|
|
|
|
|
|
except Exception:
|
|
|
|
|
traceback.print_exc()
|
|
|
|
|
# 启动服务器失败(状态修改为3)
|
|
|
|
|
set_status(db_path, 3)
|
|
|
|
|
os.kill(os.getpid(), signal.SIGTERM)
|
|
|
|
|
exit(0)
|
|
|
|
|