Skip to content

Commit

Permalink
#31 Use message delay seconds instead of Thread::sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
binchoo committed Oct 1, 2022
1 parent 2a8cda6 commit fff325b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

public class DailyCheckWorkerLambda {

private static final long RETRY_SLEEP = 3000;

private DailyCheckPort dailyCheckPort;

public DailyCheckWorkerLambda() {
Expand All @@ -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();
}
}
Expand Down
4 changes: 2 additions & 2 deletions PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -242,7 +243,6 @@ Resources:
MaximumBatchingWindowInSeconds: 3
BatchSize: 10
EventInvokeConfig:
MaximumRetryAttempts: 2
MaximumEventAgeInSeconds: 1800
Policies:
- DynamoDBCrudPolicy:
Expand Down

0 comments on commit fff325b

Please sign in to comment.