Skip to content

Commit 110a8ea

Browse files
committed
Added queue updating logging. For Triggering changed the concurrency limit calculation to match deploying
1 parent 10f0ef3 commit 110a8ea

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

apps/webapp/app/v3/services/createBackgroundWorker.server.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ export async function createBackgroundTasks(
202202
});
203203

204204
if (typeof taskQueue.concurrencyLimit === "number") {
205+
logger.debug("CreateBackgroundWorkerService: updating concurrency limit", {
206+
workerId: worker.id,
207+
taskQueue,
208+
orgId: environment.organizationId,
209+
projectId: environment.projectId,
210+
environmentId: environment.id,
211+
concurrencyLimit,
212+
taskidentifier: task.id,
213+
});
205214
await marqs?.updateQueueConcurrencyLimits(
206215
environment,
207216
taskQueue.name,

apps/webapp/app/v3/services/triggerTask.server.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,16 @@ export class TriggerTaskService extends BaseService {
439439

440440
if (body.options?.queue) {
441441
const concurrencyLimit =
442-
typeof body.options.queue.concurrencyLimit === "number"
443-
? Math.max(0, body.options.queue.concurrencyLimit)
444-
: undefined;
442+
typeof body.options.queue?.concurrencyLimit === "number"
443+
? Math.max(
444+
Math.min(
445+
body.options.queue.concurrencyLimit,
446+
environment.maximumConcurrencyLimit,
447+
environment.organization.maximumConcurrencyLimit
448+
),
449+
0
450+
)
451+
: null;
445452

446453
let taskQueue = await tx.taskQueue.findFirst({
447454
where: {
@@ -468,6 +475,16 @@ export class TriggerTaskService extends BaseService {
468475
});
469476

470477
if (typeof taskQueue.concurrencyLimit === "number") {
478+
logger.debug("TriggerTaskService: updating concurrency limit", {
479+
runId: taskRun.id,
480+
friendlyId: taskRun.friendlyId,
481+
taskQueue,
482+
orgId: environment.organizationId,
483+
projectId: environment.projectId,
484+
existingConcurrencyLimit,
485+
concurrencyLimit,
486+
queueOptions: body.options?.queue,
487+
});
471488
await marqs?.updateQueueConcurrencyLimits(
472489
environment,
473490
taskQueue.name,

0 commit comments

Comments
 (0)