Store history when iterator reset the step info (#14684)
- before reseting the step, enrich info with previous result - reset only when a step is executed more than once. This will avoid to store the initial `NOT_STARTED` status of the step
This commit is contained in:
+17
-1
@@ -105,7 +105,7 @@ export class IteratorWorkflowAction implements WorkflowActionInterface {
|
||||
hasProcessedAllItems,
|
||||
};
|
||||
|
||||
if (!hasProcessedAllItems) {
|
||||
if (!hasProcessedAllItems && currentItemIndex > 0) {
|
||||
await this.resetStepsInLoop({
|
||||
iteratorStepId,
|
||||
initialLoopStepIds,
|
||||
@@ -140,6 +140,14 @@ export class IteratorWorkflowAction implements WorkflowActionInterface {
|
||||
steps,
|
||||
});
|
||||
|
||||
const workflowRunToUpdate =
|
||||
await this.workflowRunWorkspaceService.getWorkflowRunOrFail({
|
||||
workflowRunId,
|
||||
workspaceId,
|
||||
});
|
||||
|
||||
const stepInfos = workflowRunToUpdate.state.stepInfos;
|
||||
|
||||
await this.workflowRunWorkspaceService.updateWorkflowRunStepInfos({
|
||||
stepInfos: stepIdsToReset.reduce(
|
||||
(acc, stepId) => {
|
||||
@@ -147,6 +155,14 @@ export class IteratorWorkflowAction implements WorkflowActionInterface {
|
||||
status: StepStatus.NOT_STARTED,
|
||||
result: undefined,
|
||||
error: undefined,
|
||||
history: [
|
||||
...(stepInfos[stepId]?.history ?? []),
|
||||
{
|
||||
result: stepInfos[stepId]?.result,
|
||||
error: stepInfos[stepId]?.error,
|
||||
status: stepInfos[stepId]?.status,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return acc;
|
||||
|
||||
Reference in New Issue
Block a user