Don’t send notifications for internal runs and add isTest to the notification
🚀 Publish Trigger.dev Docker / publish (push) Has been skipped
🚀 Publish Trigger.dev Docker / e2e (push) Failing after 19s
🚀 Publish Trigger.dev Docker / units (push) Failing after 3s
🚀 Publish Trigger.dev Docker / typecheck (push) Failing after 6s

This commit is contained in:
Eric Allam
2023-11-16 14:45:39 +00:00
parent 756024da78
commit 0ab51d62bc
5 changed files with 17 additions and 1 deletions
@@ -178,6 +178,7 @@ export class DeliverRunSubscriptionService {
startedAt: run.startedAt,
updatedAt: run.updatedAt,
completedAt: run.completedAt,
isTest: run.isTest,
executionDurationInMs: run.executionDuration,
executionCount: run.executionCount,
job: {
@@ -327,7 +327,7 @@ export class PerformRunExecutionV3Service {
});
}
if (headers.success && headers.data["x-trigger-run-metadata"]) {
if (headers.success && headers.data["x-trigger-run-metadata"] && !run.internal) {
logger.debug("Endpoint responded with run metadata", {
metadata: headers.data["x-trigger-run-metadata"],
});
+3
View File
@@ -40,6 +40,9 @@ This document describes the payload of a Run's completion webhook.
<ResponseField name="completedAt" type="Date" required>
When the Run started
</ResponseField>
<ResponseField name="isTest" type="boolean" required>
Whether the Run was a test Run
</ResponseField>
<ResponseField name="executionDurationInMs" type="number" required>
The duration of the Run in milliseconds
</ResponseField>
+4
View File
@@ -134,6 +134,8 @@ export type RunNotificationRunMetadata = {
updatedAt: Date;
/** When the run was completed */
completedAt: Date;
/** If the run was a test or not */
isTest: boolean;
executionDurationInMs: number;
executionCount: number;
@@ -150,6 +152,8 @@ type RunNotificationCommon<TPayload = any> = {
updatedAt: Date;
/** When the run was completed */
completedAt: Date;
/** If the run was a test or not */
isTest: boolean;
executionDurationInMs: number;
executionCount: number;
+8
View File
@@ -30,6 +30,14 @@ export const client = new TriggerClient({
ioLogLocalEnabled: true,
});
client.on("runSucceeeded", async (notification) => {
console.log("[client] Run succeeded", notification);
});
client.on("runFailed", async (notification) => {
console.log("[client] Run failed", notification);
});
createExpressServer(client);
client.defineJob({