diff --git a/packages/integration-sdk-runtime/src/execution/dependencyGraph.ts b/packages/integration-sdk-runtime/src/execution/dependencyGraph.ts index ae62ec77f..2b5cc12c2 100644 --- a/packages/integration-sdk-runtime/src/execution/dependencyGraph.ts +++ b/packages/integration-sdk-runtime/src/execution/dependencyGraph.ts @@ -453,6 +453,9 @@ export function executeStepDependencyGraph< if (createStepGraphObjectDataUploader) { uploader = createStepGraphObjectDataUploader(lastStepId); } + const stepsInvolvedInUpload = graphObjectStore.getStepsStored + ? graphObjectStore.getStepsStored() + : []; await graphObjectStore.flush( async (entities) => entities.length @@ -476,12 +479,13 @@ export function executeStepDependencyGraph< name: IntegrationErrorEventName.UnexpectedError, description: 'Upload to persister failed', }); - - executionContext.logger.stepFailure( - workingGraph.getNodeData(lastStepId), - err, - ); - stepResultsMap[lastStepId] = StepResultStatus.FAILURE; + for (const stepId of stepsInvolvedInUpload) { + executionContext.logger.stepFailure( + workingGraph.getNodeData(stepId), + err, + ); + stepResultsMap[stepId] = StepResultStatus.FAILURE; + } } } diff --git a/packages/integration-sdk-runtime/src/storage/FileSystemGraphObjectStore/FileSystemGraphObjectStore.ts b/packages/integration-sdk-runtime/src/storage/FileSystemGraphObjectStore/FileSystemGraphObjectStore.ts index 67044254d..caa67ff34 100644 --- a/packages/integration-sdk-runtime/src/storage/FileSystemGraphObjectStore/FileSystemGraphObjectStore.ts +++ b/packages/integration-sdk-runtime/src/storage/FileSystemGraphObjectStore/FileSystemGraphObjectStore.ts @@ -152,6 +152,9 @@ export class FileSystemGraphObjectStore implements GraphObjectStore { integrationStepsToGraphObjectIndexMetadataMap(params.integrationSteps); } } + getStepsStored() { + return this.localGraphObjectStore.getStepsStored(); + } async addEntities( stepId: string, diff --git a/packages/integration-sdk-runtime/src/storage/memory.ts b/packages/integration-sdk-runtime/src/storage/memory.ts index e7179e676..8f2188665 100644 --- a/packages/integration-sdk-runtime/src/storage/memory.ts +++ b/packages/integration-sdk-runtime/src/storage/memory.ts @@ -323,4 +323,22 @@ export class InMemoryGraphObjectStore implements GraphObjectStore { 0, ); } + + getStepsStored(): string[] { + const stepIds: string[] = []; + + for (const graphObjectData of this.relationshipKeyToRelationshipMap.values()) { + const { stepId } = graphObjectData; + if (!stepIds.includes(stepId)) { + stepIds.push(stepId); + } + } + for (const graphObjectData of this.entityKeyToEntityMap.values()) { + const { stepId } = graphObjectData; + if (!stepIds.includes(stepId)) { + stepIds.push(stepId); + } + } + return stepIds; + } }