Refine
This commit is contained in:
7
main.py
7
main.py
@@ -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 # 锁自动过期时间(秒)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user