Added queue updating logging. For Triggering changed the concurrency limit calculation to match deploying

This commit is contained in:
Matt Aitken
2024-12-12 13:49:17 +00:00
parent 10f0ef3301
commit 110a8ea48c
2 changed files with 29 additions and 3 deletions
@@ -202,6 +202,15 @@ export async function createBackgroundTasks(
});
if (typeof taskQueue.concurrencyLimit === "number") {
logger.debug("CreateBackgroundWorkerService: updating concurrency limit", {
workerId: worker.id,
taskQueue,
orgId: environment.organizationId,
projectId: environment.projectId,
environmentId: environment.id,
concurrencyLimit,
taskidentifier: task.id,
});
await marqs?.updateQueueConcurrencyLimits(
environment,
taskQueue.name,
@@ -439,9 +439,16 @@ export class TriggerTaskService extends BaseService {
if (body.options?.queue) {
const concurrencyLimit =
typeof body.options.queue.concurrencyLimit === "number"
? Math.max(0, body.options.queue.concurrencyLimit)
: undefined;
typeof body.options.queue?.concurrencyLimit === "number"
? Math.max(
Math.min(
body.options.queue.concurrencyLimit,
environment.maximumConcurrencyLimit,
environment.organization.maximumConcurrencyLimit
),
0
)
: null;
let taskQueue = await tx.taskQueue.findFirst({
where: {
@@ -468,6 +475,16 @@ export class TriggerTaskService extends BaseService {
});
if (typeof taskQueue.concurrencyLimit === "number") {
logger.debug("TriggerTaskService: updating concurrency limit", {
runId: taskRun.id,
friendlyId: taskRun.friendlyId,
taskQueue,
orgId: environment.organizationId,
projectId: environment.projectId,
existingConcurrencyLimit,
concurrencyLimit,
queueOptions: body.options?.queue,
});
await marqs?.updateQueueConcurrencyLimits(
environment,
taskQueue.name,