Log out when a run first starts, as well as completes
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@trigger.dev/sdk": patch
|
||||
---
|
||||
|
||||
Log out when a run first starts as well
|
||||
@@ -791,6 +791,7 @@ function createTaskQueue() {
|
||||
"x-ttl": run.workflow.triggerTtlInSeconds,
|
||||
"x-is-test": run.isTest ? "true" : "false",
|
||||
"x-app-origin": env.APP_ORIGIN,
|
||||
"x-attempt": String(run.attemptCount),
|
||||
},
|
||||
{
|
||||
eventTimestamp: run.event.timestamp.getTime(),
|
||||
|
||||
@@ -26,6 +26,7 @@ export type WorkflowRunControllerOptions = {
|
||||
organizationId: string;
|
||||
isTest: boolean;
|
||||
appOrigin: string;
|
||||
attempt: number;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -41,6 +42,7 @@ export class WorkflowRunController {
|
||||
organizationId: string;
|
||||
isTest: boolean;
|
||||
appOrigin: string;
|
||||
attempt: number;
|
||||
};
|
||||
|
||||
#logger: Logger;
|
||||
|
||||
@@ -468,6 +468,10 @@ export class TriggerServer {
|
||||
typeof properties["x-is-test"] === "string"
|
||||
? properties["x-is-test"] === "true"
|
||||
: false,
|
||||
attempt:
|
||||
typeof properties["x-attempt"] === "string"
|
||||
? Number(properties["x-attempt"])
|
||||
: 0,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ export const HostRPCSchema = {
|
||||
apiKey: z.string(),
|
||||
isTest: z.boolean().default(false),
|
||||
appOrigin: z.string(),
|
||||
attempt: z.number().optional(),
|
||||
}),
|
||||
}),
|
||||
response: z.boolean(),
|
||||
|
||||
@@ -9,6 +9,7 @@ const Catalog = {
|
||||
"x-ttl": z.coerce.number().optional(),
|
||||
"x-is-test": z.string().default("false"),
|
||||
"x-app-origin": z.string().default("https://app.trigger.dev"),
|
||||
"x-attempt": z.string().optional(),
|
||||
}),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -626,6 +626,19 @@ export class TriggerClient<TSchema extends z.ZodTypeAny> {
|
||||
() => {
|
||||
this.#logger.debug("Running trigger...");
|
||||
|
||||
if (
|
||||
typeof data.meta.attempt === "number" &&
|
||||
data.meta.attempt === 0
|
||||
) {
|
||||
this.#logger.log(
|
||||
`Run ${data.id} started 👉 ${terminalLink(
|
||||
"View on dashboard",
|
||||
`${this.#registerResponse!.url}/runs/${data.id}`,
|
||||
{ fallback: (text, url) => `${text}: (${url})` }
|
||||
)}`
|
||||
);
|
||||
}
|
||||
|
||||
serverRPC
|
||||
.send("START_WORKFLOW_RUN", {
|
||||
runId: data.id,
|
||||
|
||||
Reference in New Issue
Block a user