diff --git a/lib/lambda-worker/lambda-worker.ts b/lib/lambda-worker/lambda-worker.ts index bf9df48..0636dfc 100644 --- a/lib/lambda-worker/lambda-worker.ts +++ b/lib/lambda-worker/lambda-worker.ts @@ -148,6 +148,7 @@ export class LambdaWorker extends Construct { new SqsEventSource(lambdaDLQ, { enabled: false, batchSize: 1, + maxConcurrency: props.lambdaProps.queueMaxConcurrency, }), ); diff --git a/test/infra/lambda-worker/lambda-worker.test.ts b/test/infra/lambda-worker/lambda-worker.test.ts index 27e503d..3c2bca1 100644 --- a/test/infra/lambda-worker/lambda-worker.test.ts +++ b/test/infra/lambda-worker/lambda-worker.test.ts @@ -105,6 +105,30 @@ describe("LambdaWorker", () => { }); }); + 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", () => { Template.fromStack(stack).resourceCountIs("AWS::CloudWatch::Alarm", 3); });