Skip to content

Commit

Permalink
increase memory cron lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
its-felix committed Nov 19, 2024
1 parent a344076 commit 4f5585b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions cdk/lib/constructs/cron-lambda-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface CronLambdaConstructProps {

export class CronLambdaConstruct extends Construct {
readonly lambda_1G: IFunction;
readonly lambda_2G: IFunction;
readonly lambda_4G: IFunction;

constructor(scope: Construct, id: string, props: CronLambdaConstructProps) {
super(scope, id);
Expand Down Expand Up @@ -54,12 +54,12 @@ export class CronLambdaConstruct extends Construct {
memorySize: 1024,
});

this.lambda_2G = new Function(this, 'CronLambda_2G', {
this.lambda_4G = new Function(this, 'CronLambda_4G', {
...lambdaBaseProps,
memorySize: 1024 * 2,
memorySize: 1024 * 4,
});

for (const fn of [this.lambda_1G, this.lambda_2G]) {
for (const fn of [this.lambda_1G, this.lambda_4G]) {
props.dataBucket.grantRead(fn, 'raw/LH_Public_Data/flightschedules/*');
props.dataBucket.grantWrite(fn, 'raw/LH_Public_Data/*');
props.dataBucket.grantWrite(fn, 'raw/ourairports_data/*');
Expand Down
10 changes: 5 additions & 5 deletions cdk/lib/constructs/sfn-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { LambdaInvoke } from 'aws-cdk-lib/aws-stepfunctions-tasks';
export interface SfnConstructProps {
dataBucket: IBucket;
cronLambda_1G: IFunction;
cronLambda_2G: IFunction;
cronLambda_4G: IFunction;
webhookUrl: cdk.SecretValue;
}

Expand Down Expand Up @@ -105,7 +105,7 @@ export class SfnConstruct extends Construct {
// region conversion
.otherwise(
new LambdaInvoke(this, 'ConvertSchedulesTask', {
lambdaFunction: props.cronLambda_2G,
lambdaFunction: props.cronLambda_4G,
payload: TaskInput.fromObject({
'action': 'convert_flight_schedules',
'params': {
Expand All @@ -121,7 +121,7 @@ export class SfnConstruct extends Construct {
retryOnServiceExceptions: true,
})
.next(new LambdaInvoke(this, 'ConvertFlightsTask', {
lambdaFunction: props.cronLambda_2G,
lambdaFunction: props.cronLambda_4G,
payload: TaskInput.fromObject({
'action': 'convert_flights',
'params': {
Expand All @@ -137,7 +137,7 @@ export class SfnConstruct extends Construct {
retryOnServiceExceptions: true,
}))
.next(new LambdaInvoke(this, 'UpdateAllegrisFeedTask', {
lambdaFunction: props.cronLambda_2G,
lambdaFunction: props.cronLambda_4G,
payload: TaskInput.fromObject({
'action': 'update_allegris_feed',
'params': {
Expand All @@ -152,7 +152,7 @@ export class SfnConstruct extends Construct {
retryOnServiceExceptions: true,
}))
.next(new LambdaInvoke(this, 'UpdateMetadataTask', {
lambdaFunction: props.cronLambda_2G,
lambdaFunction: props.cronLambda_4G,
payload: TaskInput.fromObject({
'action': 'update_metadata',
'params': {
Expand Down
2 changes: 1 addition & 1 deletion cdk/lib/stacks/cron-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class CronStack extends cdk.Stack {
const sfn = new SfnConstruct(this, 'SFN', {
dataBucket: props.dataBucket,
cronLambda_1G: cronLambda.lambda_1G,
cronLambda_2G: cronLambda.lambda_2G,
cronLambda_4G: cronLambda.lambda_4G,
webhookUrl: cdk.SecretValue.cfnParameter(new cdk.CfnParameter(this, 'webhookUrl', {
type: 'String',
noEcho: true,
Expand Down

0 comments on commit 4f5585b

Please sign in to comment.