Remove unnecessary logger info
This commit is contained in:
11
main.py
11
main.py
@@ -201,8 +201,6 @@ async def fastapi_run_project(network: str) -> str:
|
||||
# 尝试获取锁(NX=True: 不存在时设置,EX=timeout: 过期时间)
|
||||
acquired = redis_client.set(lock_key, "locked", nx=True, ex=timeout)
|
||||
|
||||
logger.info(f"acquired : {acquired}")
|
||||
|
||||
if not acquired:
|
||||
raise HTTPException(status_code=409, detail="is in simulation")
|
||||
else:
|
||||
@@ -224,20 +222,15 @@ async def fastapi_run_project_return_dict(network: str) -> dict[str, Any]:
|
||||
# 尝试获取锁(NX=True: 不存在时设置,EX=timeout: 过期时间)
|
||||
acquired = redis_client.set(lock_key, "locked", nx=True, ex=timeout)
|
||||
|
||||
logger.info(f"acquired : {acquired}")
|
||||
|
||||
if not acquired:
|
||||
raise HTTPException(status_code=409, detail="is in simulation")
|
||||
else:
|
||||
try:
|
||||
result = run_project_return_dict(network)
|
||||
logger.info(f"run project result: {result}")
|
||||
return result
|
||||
return run_project_return_dict(network)
|
||||
finally:
|
||||
# 手动释放锁(可选,依赖过期时间自动释放更安全)
|
||||
redis_client.delete(lock_key)
|
||||
|
||||
|
||||
|
||||
# put in inp folder, name without extension
|
||||
@app.get("/runinp/")
|
||||
async def fastapi_run_inp(network: str) -> str:
|
||||
|
||||
Reference in New Issue
Block a user