Skip to content

Commit

Permalink
Added queue updating logging. For Triggering changed the concurrency …
Browse files Browse the repository at this point in the history
…limit calculation to match deploying
  • Loading branch information
matt-aitken committed Dec 12, 2024
1 parent 10f0ef3 commit 110a8ea
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
9 changes: 9 additions & 0 deletions apps/webapp/app/v3/services/createBackgroundWorker.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 20 additions & 3 deletions apps/webapp/app/v3/services/triggerTask.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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,
Expand Down

0 comments on commit 110a8ea

Please sign in to comment.