Skip to content

Commit

Permalink
add initial check to support partially completed executions
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed Oct 28, 2024
1 parent e16b0d3 commit 051f8b6
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions cdk/lib/constructs/sfn-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,31 @@ export class SfnConstruct extends Construct {

const checkRemainingChoice = new Choice(this, 'CheckRemaining', {});

const definition = new LambdaInvoke(this, 'PrepareDailyCron', {
lambdaFunction: props.cronLambda_1G,
payload: TaskInput.fromObject({
'action': 'cron',
'params': {
'prepareDailyCron': {
'time': JsonPath.stringAt('$.time'),
'offset': -1,
'total': 30 * 12,
const definition = new Choice(this, 'CheckInitial', {})
.when(
Condition.isNotPresent('$.loadScheduleRanges'),
new LambdaInvoke(this, 'PrepareDailyCron', {
lambdaFunction: props.cronLambda_1G,
payload: TaskInput.fromObject({
'action': 'cron',
'params': {
'prepareDailyCron': {
'time': JsonPath.stringAt('$.time'),
'offset': -1,
'total': 30 * 12,
},
},
}),
payloadResponseOnly: true,
resultSelector: {
'completed': [],
'remaining': JsonPath.objectAt('$.prepareDailyCron.dateRanges'),
},
},
}),
payloadResponseOnly: true,
resultSelector: {
'completed': [],
'remaining': JsonPath.objectAt('$.prepareDailyCron.dateRanges'),
},
resultPath: '$.loadScheduleRanges',
retryOnServiceExceptions: true,
})
resultPath: '$.loadScheduleRanges',
retryOnServiceExceptions: true,
}),
)
.afterwards()
.next(
checkRemainingChoice
// region loop body -> remaining dates
Expand Down

0 comments on commit 051f8b6

Please sign in to comment.