Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 :: (#21) 랭킹 업데이트 Scheduler 추가 #22

Merged
merged 7 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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