-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
๐ :: (#21) ๋ญํน ์
๋ฐ์ดํธ Scheduler ์ถ๊ฐ
๐ :: (#21) ๋ญํน ์ ๋ฐ์ดํธ Scheduler ์ถ๊ฐ
- Loading branch information
Showing
6 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...structure/src/main/kotlin/com/xquare/v1servicegit/common/config/SchedulerConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
18 changes: 18 additions & 0 deletions
18
git-infrastructure/src/main/kotlin/com/xquare/v1servicegit/common/scheduler/GitScheduler.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
git-infrastructure/src/main/kotlin/com/xquare/v1servicegit/common/util/Util.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters