diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index ce3756b6ae..88516b99b4 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -187,7 +187,7 @@ {#if !isTrigger}
- {#if block?.features.includes("LOOPING")} + {#if block?.features?.includes("LOOPING")} addLooping()} icon="Reuse"> Add Looping diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index f897feee86..0497a392f3 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -70,7 +70,7 @@ export const Features = { ENFORCEABLE_SSO: "enforceableSSO", BRANDING: "branding", SCIM: "scim", - SYNC_AUTOMATIONS: "syncAutoamtions", + SYNC_AUTOMATIONS: "syncAutomations", } // Role IDs diff --git a/packages/server/src/threads/automation.ts b/packages/server/src/threads/automation.ts index e2c9de20a5..f70d18bbae 100644 --- a/packages/server/src/threads/automation.ts +++ b/packages/server/src/threads/automation.ts @@ -68,6 +68,7 @@ class Orchestrator { constructor(job: AutomationJob) { let automation = job.data.automation let triggerOutput = job.data.event + let timeout = job.data.event.timeout const metadata = triggerOutput.metadata this._chainCount = metadata ? metadata.automationChainCount! : 0 this._appId = triggerOutput.appId as string @@ -240,7 +241,9 @@ class Orchestrator { let loopStepNumber: any = undefined let loopSteps: LoopStep[] | undefined = [] let metadata + let timeoutFlag = false let wasLoopStep = false + let timeout = this._job.data.event.timeout // check if this is a recurring automation, if (isProdAppID(this._appId) && isRecurring(automation)) { metadata = await this.getMetadata() @@ -251,6 +254,16 @@ class Orchestrator { } for (let step of automation.definition.steps) { + if (timeoutFlag) { + break + } + + if (timeout) { + setTimeout(() => { + timeoutFlag = true + }, timeout || 12000) + } + stepCount++ let input: any, iterations = 1, @@ -391,7 +404,7 @@ class Orchestrator { emitter: this._emitter, context: this._context, }) - + console.log("after stepFn") this._context.steps[stepCount] = outputs // if filter causes us to stop execution don't break the loop, set a var // so that we can finish iterating through the steps and record that it stopped