Skip to content

Commit

Permalink
feat: skip processed migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
RafalWilinski committed Aug 10, 2022
1 parent 0292892 commit df35964
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/custom-resource-is-migration-complete.ts
Expand Up @@ -6,7 +6,7 @@ import {
import { CloudFormationCustomResourceEvent } from "aws-lambda";
import { Construct } from "constructs";
import { $AWS, Function, Table } from "functionless";
import { marshall } from "typesafe-dynamodb/lib/marshall";
import { marshall, unmarshall } from "typesafe-dynamodb/lib/marshall";
import { MigrationHistoryItem } from "./migrations-manager";

type MigrationIdStateMachineArnPair = {
Expand Down Expand Up @@ -58,8 +58,19 @@ export default class CustomResourceIsMigrationCompleteChecker extends Construct
);
}

const item = unmarshall(migrationEntry.Item);

if (
item.status === "ABORTED" ||
item.status === "FAILED" ||
item.status === "SUCCEEDED" ||
item.status === "TIMED_OUT"
) {
continue;
}

const command = new DescribeExecutionCommand({
executionArn: migrationEntry.Item?.executionArn.S,
executionArn: item.executionArn,
});
const response = await client.send(command);

Expand Down

0 comments on commit df35964

Please sign in to comment.