This commit is contained in:
DingZQ
2025-01-30 22:59:02 +08:00
parent 8e4574b167
commit 29883cc123

View File

@@ -41,10 +41,6 @@ if not os.path.exists(tmpDir):
app = FastAPI()
# 初始化 Redis 连接
# 用redis 来限制并发访问
redis_client = redis.Redis(host="localhost", port=6379, db=0)
# 配置日志记录器
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
@@ -174,6 +170,9 @@ async def fastapi_dump_inp(network: str, inp: str) -> bool:
# 必须用这个PlainTextResponse不然每个key都有引号
@app.get("/runproject/", response_class = PlainTextResponse)
async def fastapi_run_project(network: str) -> str:
# 初始化 Redis 连接
# 用redis 来限制并发访问
redis_client = redis.Redis(host="localhost", port=6379, db=0)
lock_key = "exclusive_api_lock"
timeout = 120 # 锁自动过期时间(秒)