-
-
Notifications
You must be signed in to change notification settings - Fork 742
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Inconsistency found in method renaming The method is still named
🔗 Analysis chainVerify all call sites for renamed upload method The rename from Let's check for any remaining references to the old method name: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for any remaining references to the old method name
rg "uploadToObjectStore"
# Search for any imports of the old method name
ast-grep --pattern 'import { $$$, uploadToObjectStore, $$$ } from'
Length of output: 376 Script: #!/bin/bash
# Let's check the implementation and usage in both files
echo "=== Content of r2.server.ts ==="
cat apps/webapp/app/v3/r2.server.ts
echo -e "\n=== Content of triggerTask.server.ts ==="
cat apps/webapp/app/v3/services/triggerTask.server.ts
Length of output: 26530 |
||
|
||
return { | ||
data: filename, | ||
|
Uh oh!
There was an error while loading. Please reload this page.