Skip to content

Commit

Permalink
feat: set maxConcurrency on LambdaWorker DLQ
Browse files Browse the repository at this point in the history
  • Loading branch information
nemanja-kovacevic-thinkit committed Nov 20, 2024
1 parent fb0ee04 commit 78fa628
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/lambda-worker/lambda-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ export class LambdaWorker extends Construct {
new SqsEventSource(lambdaDLQ, {
enabled: false,
batchSize: 1,
maxConcurrency: props.lambdaProps.queueMaxConcurrency,
}),
);

Expand Down
26 changes: 26 additions & 0 deletions test/infra/lambda-worker/lambda-worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,32 @@ describe("LambdaWorker", () => {
VisibilityTimeout: 1500, // 5 (default max receive count) * 300 (lambda timeout)
MessageRetentionPeriod: 1209600, // 14 days
});

Template.fromStack(stack).hasResourceProperties("AWS::Lambda::EventSourceMapping", {
Enabled: true,
BatchSize: 1,
ScalingConfig: {
MaximumConcurrency: 5
},
});
});

test("provisions Lambda EventSourceMapping", () => {
Template.fromStack(stack).hasResourceProperties("AWS::Lambda::EventSourceMapping", {
Enabled: true,
BatchSize: 1,
ScalingConfig: {
MaximumConcurrency: 5
},
});

Template.fromStack(stack).hasResourceProperties("AWS::Lambda::EventSourceMapping", {
Enabled: false,
BatchSize: 1,
ScalingConfig: {
MaximumConcurrency: 5
},
});
});

test("provisions three alarms", () => {
Expand Down

0 comments on commit 78fa628

Please sign in to comment.