-
-
Notifications
You must be signed in to change notification settings - Fork 863
fix: efficient task trigger queue updates #1489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -414,20 +414,40 @@ export class TriggerTaskService extends BaseService { | |
}, | ||
}); | ||
|
||
const existingConcurrencyLimit = | ||
typeof taskQueue?.concurrencyLimit === "number" | ||
? taskQueue.concurrencyLimit | ||
: undefined; | ||
|
||
if (taskQueue) { | ||
taskQueue = await tx.taskQueue.update({ | ||
where: { | ||
id: taskQueue.id, | ||
}, | ||
data: { | ||
concurrencyLimit, | ||
rateLimit: body.options.queue.rateLimit, | ||
}, | ||
}); | ||
if (existingConcurrencyLimit !== concurrencyLimit) { | ||
taskQueue = await tx.taskQueue.update({ | ||
where: { | ||
id: taskQueue.id, | ||
}, | ||
data: { | ||
concurrencyLimit: | ||
typeof concurrencyLimit === "number" ? concurrencyLimit : null, | ||
rateLimit: body.options.queue.rateLimit, | ||
}, | ||
}); | ||
|
||
if (typeof taskQueue.concurrencyLimit === "number") { | ||
await marqs?.updateQueueConcurrencyLimits( | ||
environment, | ||
taskQueue.name, | ||
taskQueue.concurrencyLimit | ||
); | ||
} else { | ||
await marqs?.removeQueueConcurrencyLimits(environment, taskQueue.name); | ||
} | ||
} | ||
} else { | ||
const queueId = generateFriendlyId("queue"); | ||
|
||
taskQueue = await tx.taskQueue.create({ | ||
data: { | ||
friendlyId: generateFriendlyId("queue"), | ||
friendlyId: queueId, | ||
name: queueName, | ||
concurrencyLimit, | ||
runtimeEnvironmentId: environment.id, | ||
|
@@ -436,16 +456,14 @@ export class TriggerTaskService extends BaseService { | |
type: "NAMED", | ||
}, | ||
}); | ||
} | ||
|
||
if (typeof taskQueue.concurrencyLimit === "number") { | ||
await marqs?.updateQueueConcurrencyLimits( | ||
environment, | ||
taskQueue.name, | ||
taskQueue.concurrencyLimit | ||
); | ||
} else { | ||
await marqs?.removeQueueConcurrencyLimits(environment, taskQueue.name); | ||
if (typeof taskQueue.concurrencyLimit === "number") { | ||
await marqs?.updateQueueConcurrencyLimits( | ||
environment, | ||
taskQueue.name, | ||
taskQueue.concurrencyLimit | ||
); | ||
} | ||
} | ||
} | ||
|
||
|
@@ -599,7 +617,7 @@ export class TriggerTaskService extends BaseService { | |
|
||
const filename = `${pathPrefix}/payload.json`; | ||
|
||
await uploadToObjectStore(filename, packet.data, packet.dataType, environment); | ||
await uploadPacketToObjectStore(filename, packet.data, packet.dataType, environment); | ||
|
||
|
||
return { | ||
data: filename, | ||
|
Uh oh!
There was an error while loading. Please reload this page.