diff --git a/main.py b/main.py index b6fe886..f07fab5 100644 --- a/main.py +++ b/main.py @@ -150,12 +150,12 @@ app.state.lock = asyncio.Lock() # Create an async lock object # 必须用这个PlainTextResponse,不然每个key都有引号 @app.get("/runproject/", response_class = PlainTextResponse) -async def fastapi_run_project(network: str) -> str: +def fastapi_run_project(network: str) -> str: if app.state.lock.locked(): raise HTTPException(status_code=400, detail="is in simulation") else: try: - await app.state.lock.acquire() # Acquire the lock + app.state.lock.acquire() # Acquire the lock result = run_project(network) return result except asyncio.CancelledError: