add max iterations env variable

This commit is contained in:
Peter Clement 2022-04-12 09:13:01 +01:00
parent 47480450d8
commit 2d75e68717
3 changed files with 899 additions and 14 deletions

View File

@ -62,6 +62,7 @@ module.exports = {
SENDGRID_API_KEY: process.env.SENDGRID_API_KEY,
DYNAMO_ENDPOINT: process.env.DYNAMO_ENDPOINT,
POSTHOG_TOKEN: process.env.POSTHOG_TOKEN,
AUTOMATION_MAX_ITERATIONS: process.env.AUTOMATION_MAX_ITERATIONS,
// old - to remove
CLIENT_ID: process.env.CLIENT_ID,
BUDIBASE_DIR: process.env.BUDIBASE_DIR,

View File

@ -15,6 +15,7 @@ const LOOP_STEP_ID = actions.ACTION_DEFINITIONS.LOOP.stepId
const CRON_STEP_ID = triggerDefs.CRON.stepId
const STOPPED_STATUS = { success: false, status: "STOPPED" }
const { cloneDeep } = require("lodash/fp")
const env = require("../environment")
/**
* The automation orchestrator is a class responsible for executing automations.
@ -170,7 +171,10 @@ class Orchestrator {
}
}
if (index >= loopStep.inputs.iterations) {
if (
index === env.AUTOMATION_MAX_ITERATIONS ||
index === loopStep.inputs.iterations
) {
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
status: "MAX_ITERATIONS_REACHED",
success: true,

File diff suppressed because it is too large Load Diff