diff --git a/src/proxy/queue.ts b/src/proxy/queue.ts index c88da7f..3a198f7 100644 --- a/src/proxy/queue.ts +++ b/src/proxy/queue.ts @@ -30,10 +30,10 @@ import { sendErrorToClient } from "./middleware/response/error-generator"; const queue: Request[] = []; const log = logger.child({ module: "request-queue" }); -/** Maximum number of queue slots for Agnai.chat requests. */ -const AGNAI_CONCURRENCY_LIMIT = 5; /** Maximum number of queue slots for individual users. */ -const USER_CONCURRENCY_LIMIT = 1; +const USER_CONCURRENCY_LIMIT = parseInt(process.env.USER_CONCURRENCY_LIMIT ?? "1"); +/** Maximum number of queue slots for Agnai.chat requests. */ +const AGNAI_CONCURRENCY_LIMIT = USER_CONCURRENCY_LIMIT * 5; const MIN_HEARTBEAT_SIZE = parseInt(process.env.MIN_HEARTBEAT_SIZE_B ?? "512"); const MAX_HEARTBEAT_SIZE = 1024 * parseInt(process.env.MAX_HEARTBEAT_SIZE_KB ?? "1024");