refactor: Restructure workers to work with services

This commit is contained in:
Faruk AYDIN
2022-10-14 22:33:26 +02:00
parent 628f872180
commit 237ab48d33
10 changed files with 81 additions and 114 deletions

View File

@@ -23,16 +23,6 @@ const testRun = async (options: TestRunOptions) => {
testRun: true,
});
const firstTriggerDataItem = data[0];
const { executionId, executionStep: triggerExecutionStep } =
await processTrigger({
flowId: flow.id,
stepId: triggerStep.id,
triggerDataItem: firstTriggerDataItem,
testRun: true,
});
if (triggerError) {
const { executionStep: triggerExecutionStepWithError } =
await processTrigger({
@@ -45,6 +35,16 @@ const testRun = async (options: TestRunOptions) => {
return { executionStep: triggerExecutionStepWithError };
}
const firstTriggerDataItem = data[0];
const { executionId, executionStep: triggerExecutionStep } =
await processTrigger({
flowId: flow.id,
stepId: triggerStep.id,
triggerDataItem: firstTriggerDataItem,
testRun: true,
});
if (triggerStep.id === untilStep.id) {
return { executionStep: triggerExecutionStep };
}
@@ -56,7 +56,7 @@ const testRun = async (options: TestRunOptions) => {
executionId,
});
if (actionStep.id === untilStep.id || actionExecutionStep.errorDetails) {
if (actionStep.id === untilStep.id || actionExecutionStep.isFailed) {
return { executionStep: actionExecutionStep };
}
}

View File

@@ -29,7 +29,7 @@ export const processTrigger = async (options: ProcessTriggerOptions) => {
const execution = await Execution.query().insert({
flowId: $.flow.id,
testRun,
internalId: triggerDataItem.meta.internalId,
internalId: triggerDataItem?.meta.internalId,
});
const executionStep = await execution