From 950efb826da6b7ea29f7745ede8b66b67c23b723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haylee=20Sch=C3=A4fer?= Date: Tue, 21 Jan 2025 22:44:53 +0100 Subject: [PATCH] move queue limit to grants --- src/models/v2/generate.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/models/v2/generate.ts b/src/models/v2/generate.ts index f397aa2b..da6c1518 100644 --- a/src/models/v2/generate.ts +++ b/src/models/v2/generate.ts @@ -382,7 +382,8 @@ async function v2SubmitGeneratorJob(req: GenerateV2Request, res: Response 5) { // TODO: configurable / client grant + const limit = req.client.getQueueLimit(); + if (pendingByUser > limit) { throw new GeneratorError('job_limit', "You have too many jobs in the queue", { httpCode: 429, source: ErrorSource.CLIENT @@ -390,7 +391,7 @@ async function v2SubmitGeneratorJob(req: GenerateV2Request, res: Response 5) { // TODO: configurable / client grant + if (pendingByIp > 4) { throw new GeneratorError('job_limit', "You have too many jobs in the queue", { httpCode: 429, source: ErrorSource.CLIENT