diff --git a/PaimonGanyu/paimonganyu-app/paimonganyu-skill/samconfig.toml b/PaimonGanyu/paimonganyu-app/paimonganyu-skill/samconfig.toml index ce2d358..5cff7dc 100644 --- a/PaimonGanyu/paimonganyu-app/paimonganyu-skill/samconfig.toml +++ b/PaimonGanyu/paimonganyu-app/paimonganyu-skill/samconfig.toml @@ -3,11 +3,11 @@ version = 0.1 [default.deploy] [default.deploy.parameters] stack_name = "paimonganyu-skill" -s3_bucket = "aws-sam-cli-managed-default-samclisourcebucket-idkhpdkh78w2" +s3_bucket = "aws-sam-cli-managed-default-samclisourcebucket-3t80l0g3f3ma" s3_prefix = "paimonganyu-skill" region = "ap-northeast-2" -profile = "pgtest" +profile = "pgprod" capabilities = "CAPABILITY_IAM" -parameter_overrides = "Env=\"test\" UseALB=\"False\"" +parameter_overrides = "Env=\"prod\" UseALB=\"False\"" image_repositories = [] disable_rollback = true diff --git a/PaimonGanyu/paimonganyu-app/paimonganyu/samconfig.toml b/PaimonGanyu/paimonganyu-app/paimonganyu/samconfig.toml index 3fe1a75..766ee36 100644 --- a/PaimonGanyu/paimonganyu-app/paimonganyu/samconfig.toml +++ b/PaimonGanyu/paimonganyu-app/paimonganyu/samconfig.toml @@ -3,10 +3,10 @@ version = 0.1 [default.deploy] [default.deploy.parameters] stack_name = "paimonganyu" -s3_bucket = "aws-sam-cli-managed-default-samclisourcebucket-idkhpdkh78w2" +s3_bucket = "aws-sam-cli-managed-default-samclisourcebucket-3t80l0g3f3ma" s3_prefix = "paimonganyu" region = "ap-northeast-2" -profile = "pgtest" +profile = "pgprod" capabilities = "CAPABILITY_IAM" image_repositories = [] -parameter_overrides = "Env=\"test\"" +parameter_overrides = "Env=\"prod\"" diff --git a/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckBatchRequesterLambda.java b/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckBatchRequesterLambda.java index 7836b68..7f9a4ea 100644 --- a/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckBatchRequesterLambda.java +++ b/PaimonGanyu/paimonganyu-app/paimonganyu/src/main/java/org/binchoo/paimonganyu/lambda/dailycheck/DailyCheckBatchRequesterLambda.java @@ -6,6 +6,7 @@ import com.amazonaws.services.cloudwatch.model.StandardUnit; import com.amazonaws.services.lambda.runtime.events.ScheduledEvent; import com.amazonaws.services.sqs.AmazonSQS; +import com.amazonaws.services.sqs.model.SendMessageRequest; import com.fasterxml.jackson.databind.ObjectMapper; import org.binchoo.paimonganyu.dailycheck.driving.DailyCheckPort; import org.binchoo.paimonganyu.hoyopass.driven.UserHoyopassCrudPort; @@ -17,6 +18,7 @@ import java.util.List; import java.util.Objects; +import java.util.Random; public class DailyCheckBatchRequesterLambda { @@ -59,9 +61,13 @@ private void lookupDependencies(GenericApplicationContext context) { } public void handler(ScheduledEvent event) { + Random r = new Random(); hoyopassCrud.findAll().stream().map(DailyCheckTaskSpec::specify) .flatMap(List::stream) .filter(task-> !dailyCheck.hasCheckedInToday(task.getBotUserId(), task.getLtuid())) - .forEach(task-> sqsClient.sendMessage(DAILYCHECK_QUEUE_URL, task.asJson(objectMapper))); + .forEach(task-> sqsClient.sendMessage(new SendMessageRequest() + .withQueueUrl(DAILYCHECK_QUEUE_URL) + .withMessageBody(task.asJson(objectMapper)) + .withDelaySeconds(r.nextInt() % 20 + 1))); } } diff --git a/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml b/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml index ef3e3b5..ce77162 100644 --- a/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml +++ b/PaimonGanyu/paimonganyu-app/paimonganyu/template.yaml @@ -182,9 +182,8 @@ Resources: Type: AWS::SQS::Queue Properties: VisibilityTimeout: 60 - DelaySeconds: 7 RedrivePolicy: - maxReceiveCount: 3 + maxReceiveCount: 2 deadLetterTargetArn: !GetAtt DailyCheckRequestDLQ.Arn DailyCheckRequestDLQ: @@ -217,7 +216,7 @@ Resources: FirstDailyCheckEvent: Type: Schedule Properties: - Schedule: 'cron(1/8 16 ? * * *)' # everyday 01:[01, 09, ..., 57]AM (Seoul) + Schedule: 'cron(1/11 16 ? * * *)' # everyday 01:[01, 12, ..., 56]AM (Seoul) Name: first-dailycheck Description: Do batch daily check-in serveral times around 01:00AM Enabled: true