From fff325bd06517b748700af82c6725aac2d495a25 Mon Sep 17 00:00:00 2001 From: binchoo <079111w@gmail.com> Date: Sat, 1 Oct 2022 22:31:19 +0900 Subject: [PATCH] #31 Use message delay seconds instead of Thread::sleep --- .../lambda/dailycheck/DailyCheckWorkerLambda.java | 6 ------ PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml | 4 ++-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckWorkerLambda.java b/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckWorkerLambda.java index c400ec1..8144396 100644 --- a/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckWorkerLambda.java +++ b/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckWorkerLambda.java @@ -12,8 +12,6 @@ public class DailyCheckWorkerLambda { - private static final long RETRY_SLEEP = 3000; - private DailyCheckPort dailyCheckPort; public DailyCheckWorkerLambda() { @@ -37,10 +35,6 @@ private void claim(DailyCheckTaskSpec taskSpec) { String botUserId = taskSpec.getBotUserId(), ltuid = taskSpec.getLtuid(), ltoken = taskSpec.getLtoken(); UserDailyCheck userDailyCheck = dailyCheckPort.claimDailyCheckIn(botUserId, ltuid, ltoken); if (!userDailyCheck.isDone()) { - try { - Thread.sleep(RETRY_SLEEP); - } catch (Exception ignored) { - } throw new RuntimeException(); } } diff --git a/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml b/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml index c3fa9f3..c1af3bb 100644 --- a/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml +++ b/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml @@ -182,9 +182,10 @@ Resources: Type: AWS::SQS::Queue Properties: VisibilityTimeout: 60 + DelaySeconds: 7 RedrivePolicy: + maxReceiveCount: 3 deadLetterTargetArn: !GetAtt DailyCheckRequestDLQ.Arn - maxReceiveCount: 2 DailyCheckRequestDLQ: Type: AWS::SQS::Queue @@ -242,7 +243,6 @@ Resources: MaximumBatchingWindowInSeconds: 3 BatchSize: 10 EventInvokeConfig: - MaximumRetryAttempts: 2 MaximumEventAgeInSeconds: 1800 Policies: - DynamoDBCrudPolicy: