Skip to content

Commit

Permalink
feat: increase lambda worker default message retention period (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
malcyL authored Aug 14, 2023
1 parent 846ce58 commit 4c7bd4d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/lambda-worker/lambda-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class LambdaWorker extends cdk.Construct {
const lambdaDLQ = new sqs.Queue(this, `${props.name}-dlq`, {
queueName: dlqName,
visibilityTimeout: queueTimeout,
retentionPeriod: cdk.Duration.days(14),
fifo: fifo ? true : undefined, // This is required for fifo, but has to be undefined not flase for non-fifo
});

Expand All @@ -99,6 +100,7 @@ export class LambdaWorker extends cdk.Construct {
const lambdaQueue = new sqs.Queue(this, `${props.name}-queue`, {
queueName,
visibilityTimeout: queueTimeout,
retentionPeriod: cdk.Duration.days(14),
deadLetterQueue: { queue: lambdaDLQ, maxReceiveCount: maxReceiveCount },
fifo: fifo ? true : undefined, // This is required for fifo, but has to be undefined not flase for non-fifo
contentBasedDeduplication:
Expand Down
2 changes: 2 additions & 0 deletions test/infra/lambda-worker/lambda-worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ describe("LambdaWorker", () => {
haveResourceLike("AWS::SQS::Queue", {
QueueName: "MyTestLambdaWorker-queue",
VisibilityTimeout: 1500, // 5 (default max receive count) * 300 (lambda timeout)
MessageRetentionPeriod: 1209600, // 14 days
RedrivePolicy: {
maxReceiveCount: 5,
deadLetterTargetArn: {
Expand All @@ -106,6 +107,7 @@ describe("LambdaWorker", () => {
haveResourceLike("AWS::SQS::Queue", {
QueueName: "MyTestLambdaWorker-dlq",
VisibilityTimeout: 1500, // 5 (default max receive count) * 300 (lambda timeout)
MessageRetentionPeriod: 1209600, // 14 days
})
);
});
Expand Down

0 comments on commit 4c7bd4d

Please sign in to comment.