Skip to content

Commit

Permalink
๐Ÿ”€ :: (#21) ๋žญํ‚น ์—…๋ฐ์ดํŠธ Scheduler ์ถ”๊ฐ€
Browse files Browse the repository at this point in the history
๐Ÿ”€ :: (#21) ๋žญํ‚น ์—…๋ฐ์ดํŠธ Scheduler ์ถ”๊ฐ€
  • Loading branch information
jeongho1209 authored Dec 26, 2023
2 parents 90f33ec + 1fb030e commit 52aec33
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/xquare-deployment-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,4 @@ jobs:
buildargs: |
CLOUD_CONFIG_PASSWORD=${{secrets.CLOUD_CONFIG_PASSWORD}}
CLOUD_CONFIG_USERNAME=${{secrets.CLOUD_CONFIG_USERNAME}}
CLOUD_CONFIG_IMPORT_URL=${{ secrets.CLOUD_CONFIG_IMPORT_URL }}
PROFILE=prod
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.xquare.v1servicegit.common.config

import org.springframework.context.annotation.Configuration
import org.springframework.scheduling.annotation.EnableScheduling

@EnableScheduling
@Configuration
class SchedulerConfiguration
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.xquare.v1servicegit.common.scheduler

import com.xquare.v1servicegit.common.util.logger
import com.xquare.v1servicegit.git.usecase.GitUseCase
import kotlinx.coroutines.runBlocking
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Component

@Component
class GitScheduler(
private val gitUseCase: GitUseCase,
) {
@Scheduled(cron = "* 30 * * * *")
fun gitScheduler() {
runBlocking { gitUseCase.updateGitInfo() }
logger().info("update success")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.xquare.v1servicegit.common.util

import org.slf4j.LoggerFactory

inline fun <reified T> T.logger() = LoggerFactory.getLogger(T::class.java)!!
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class GitPersistenceAdapter(

override suspend fun updateContributionCount(gitAllInfo: List<Git>): Map<UUID, Int> = coroutineScope {
gitAllInfo.map { git ->
scope.async() {
scope.async {
val contribution = getContributionCount(git.username)
git.userId to contribution
}
Expand Down
2 changes: 1 addition & 1 deletion git-infrastructure/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ spring:
application:
name: v1-git-service
config:
import: ${CLOUD_CONFIG_IMPORT_URL:optional:configserver:https://api.xquare.app/cloud-config/}
import: optional:configserver:https://prod-server.xquare.app/cloud-config/
cloud:
config:
username: ${CLOUD_CONFIG_USERNAME}
Expand Down

0 comments on commit 52aec33

Please sign in to comment.