Skip to content

Commit

Permalink
Fix the schedule for the super mode lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
“LAKSHMIRPILLAI” committed Nov 13, 2024
1 parent b1a5cec commit f5f91a2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 21 deletions.
47 changes: 37 additions & 10 deletions cdk/lib/__snapshots__/super-mode-calculator.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 2 additions & 11 deletions cdk/lib/super-mode-calculator.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {GuScheduledLambda} from "@guardian/cdk";
import type { GuStackProps } from '@guardian/cdk/lib/constructs/core';
import {GuStack, GuStringParameter} from '@guardian/cdk/lib/constructs/core';
import { GuStack } from '@guardian/cdk/lib/constructs/core';
import {type App, Duration, RemovalPolicy} from 'aws-cdk-lib';
import {AttributeType, BillingMode, ProjectionType, Table} from "aws-cdk-lib/aws-dynamodb";
import { Schedule } from 'aws-cdk-lib/aws-events';
Expand All @@ -12,20 +12,11 @@ export class SuperModeCalculator extends GuStack {
constructor(scope: App, id: string, props: GuStackProps) {
super(scope, id, props);

const scheduleState = new GuStringParameter(this, 'ScheduleState', {
description: 'The state of the schedule',
default: 'ENABLED',
allowedValues: ['ENABLED', 'DISABLED'],
});

const scheduleRules =
scheduleState.valueAsString === 'ENABLED'
? [
const scheduleRules = [
{
schedule: Schedule.rate(Duration.minutes(60)),
},
]
: [];

const superModeCalculatorTable = new Table(this, 'super-mode-calculator-table', {
tableName: `super-mode-calculator-${this.stage}`,
Expand Down

0 comments on commit f5f91a2

Please sign in to comment.