This commit is contained in:
DingZQ
2023-10-21 00:14:22 +08:00
parent 890f8d9cf6
commit bf04c6493f

View File

@@ -34,8 +34,6 @@ if not os.path.exists(tmpDir):
app = FastAPI()
lock = asyncio.Lock()
app.add_middleware(GZipMiddleware, minimum_size=1000)
############################################################
@@ -147,10 +145,11 @@ async def fastapi_dump_inp(network: str, inp: str) -> bool:
dump_inp(network, inp)
return True
lock = asyncio.Lock()
# 必须用这个PlainTextResponse不然每个key都有引号
@app.get("/runproject/", response_class = PlainTextResponse)
async def fastapi_run_project(network: str) -> str:
global lock
if lock.locked():
raise HTTPException(status_code=400, detail="is in simulation")
else: