Don’t send notifications for internal runs and add isTest to the notification
This commit is contained in:
@@ -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"],
|
||||
});
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user