Skip to content

Commit

Permalink
feat: 스케줄러 시간 조절
Browse files Browse the repository at this point in the history
  • Loading branch information
injoon2019 committed Oct 3, 2024
1 parent 5fcd36a commit 565dc69
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ class StatisticsScheduler(
.baseUrl(slackUrl)
.build()

@Scheduled(cron = "0 0/5 * * * *")
@Scheduled(cron = "0 0 10 * * *")
fun sendDailyStatistics() {
log.info { "데일리 지표 스케줄러 돌기 시작" }
log.info { "slackUrl=$slackUrl" }
val yesterday = LocalDate.now().minusDays(1)

val allUsers = userRepository.findAll()
Expand Down Expand Up @@ -74,21 +72,16 @@ class StatisticsScheduler(
)
)

log.info { "Sending request to Slack: ${ObjectMapper().writeValueAsString(request)}" }

val response = webClient.post()
.contentType(MediaType.APPLICATION_JSON)
.body(BodyInserters.fromValue(request))
.retrieve()
.bodyToMono(String::class.java)
.block()

log.info { "response: $response" }
}

@Scheduled(cron = "* * 10 * * 1")
fun sendWeeklyStatistics() {
log.info { "위클리 지표 스케줄러 돌기 시작" }
val lastWeekMonday = LocalDate.now().minusDays(7)
val lastWeekSunday = LocalDate.now().minusDays(1)

Expand Down

0 comments on commit 565dc69

Please sign in to comment.