Files
Eric Allam 8d5c86fea0 v4: simplified release concurrency system and status changes (#2284)
* WIP

* Make release concurrency system extremely simple, everything just releases all the time

* update the deadlock detection to use the new lockedQueueReleaseConcurrencyOnWaitpoint column

* WIP new release concurrency system

* Remove releaseConcurrency and releaseConcurrencyOnWaitpoint

Also removed deadlock detection, and added environment burst concurrency

* Added new DEQUEUED status

Cleaned up the API run statuses, including now detecting new clients and not breaking older clients by adding an API version header to all requests

* Introduce the new "current dequeued concurrency set"

* Remove QUEUED_EXECUTING because we no longer "eagerly" release before checkpointing

* Remove waitpoint test for QUEUED_EXECUTING

* Add isWaiting

* Add changeset

* Use createdAt for ordering realtime runs instead of number

* Clarify the envCurrentDequeuedKey usage

* mock the db.server file to fix the tests

* Updated changset "EXECUTED" -> "EXECUTING"

---------

Co-authored-by: Matt Aitken <matt@mattaitken.com>
2025-07-21 15:45:27 +01:00

30 lines
692 B
TypeScript

import { logger, runs, task } from "@trigger.dev/sdk";
export const statusesTest = task({
id: "statuses-test",
run: async () => {
console.log("statusesTest");
},
});
export const subscribeToRun = task({
id: "subscribe-to-run",
run: async (payload: { runId: string }) => {
const subscription = runs.subscribeToRun(payload.runId, {
stopOnCompletion: false,
});
for await (const event of subscription) {
logger.info("run event", { event });
}
},
});
export const retrieveRun = task({
id: "retrieve-run",
run: async (payload: { runId: string }) => {
const run = await runs.retrieve(payload.runId);
logger.info("run", { run });
},
});