diff --git a/infra/infra-lambda/build.gradle.kts b/infra/infra-lambda/build.gradle.kts index 7838d78..4cc46fa 100644 --- a/infra/infra-lambda/build.gradle.kts +++ b/infra/infra-lambda/build.gradle.kts @@ -15,5 +15,5 @@ dependencies { implementation("org.springframework.boot:spring-boot-starter-data-jpa") // lambda - implementation("org.springframework.cloud:spring-cloud-function-web") + implementation("org.springframework.cloud:spring-cloud-function-web:4.1.0") } diff --git a/infra/infra-lambda/src/main/kotlin/com/kw/infralamda/consumer/LambdaConsumer.kt b/infra/infra-lambda/src/main/kotlin/com/kw/infralamda/consumer/LambdaConsumer.kt index 4fd74c1..df68e72 100644 --- a/infra/infra-lambda/src/main/kotlin/com/kw/infralamda/consumer/LambdaConsumer.kt +++ b/infra/infra-lambda/src/main/kotlin/com/kw/infralamda/consumer/LambdaConsumer.kt @@ -30,7 +30,7 @@ class LambdaConsumer(private val questionRepository: QuestionRepository, private fun updateBundlesPopularity() { val bundles = bundleRepository.findAll() bundles.forEach { bundle -> - val hours = ChronoUnit.HOURS.between(LocalDateTime.now(), bundle.createdAt).toDouble() + val hours = ChronoUnit.HOURS.between(bundle.createdAt, LocalDateTime.now()).toDouble() val popularity = getBundlePopularity(bundle, hours) bundle.updatePopularity(popularity) } @@ -42,7 +42,7 @@ class LambdaConsumer(private val questionRepository: QuestionRepository, private fun updateQuestionPopularity() { val questions = questionRepository.findAll() questions.forEach { question -> - val hours = ChronoUnit.HOURS.between(LocalDateTime.now(), question.createdAt).toDouble() + val hours = ChronoUnit.HOURS.between(question.createdAt, LocalDateTime.now()).toDouble() val popularity = getQuestionPopularity(question, hours) question.updatePopularity(popularity) } diff --git a/infra/infra-lambda/src/main/resources/application.properties b/infra/infra-lambda/src/main/resources/application.properties deleted file mode 100644 index 3ce70ac..0000000 --- a/infra/infra-lambda/src/main/resources/application.properties +++ /dev/null @@ -1 +0,0 @@ -spring.application.name=infra-lamda diff --git a/infra/infra-lambda/src/main/resources/application.yml b/infra/infra-lambda/src/main/resources/application.yml new file mode 100644 index 0000000..cfc3fb3 --- /dev/null +++ b/infra/infra-lambda/src/main/resources/application.yml @@ -0,0 +1,4 @@ +spring: + profiles: + include: rdb + active: dev