Skip to content

Commit

Permalink
feat: 그룹 랭킹 리프레시 api
Browse files Browse the repository at this point in the history
  • Loading branch information
DongGeon0908 committed Sep 25, 2024
1 parent 5c99dd3 commit 4ad6baa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import org.springframework.stereotype.Component
class GroupRankScheduler(
private val groupRankRefreshJob: GroupRankRefreshJob,
) {
/** 5분에 한번 스케줄러 동작 */
@Scheduled(fixedRate = 300000)
/** 10초에 한번 스케줄러 동작 */
@Scheduled(fixedRate = 10000)
fun runRefreshGroupRank() {
CoroutineScope(Dispatchers.IO + Job()).launch {
groupRankRefreshJob.run()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.hero.alignlab.domain.dev.resource

import com.hero.alignlab.batch.grouprank.job.GroupRankRefreshJob
import com.hero.alignlab.config.swagger.SwaggerTag.DEV_TAG
import com.hero.alignlab.domain.auth.model.DevAuthUser
import io.swagger.v3.oas.annotations.Operation
import io.swagger.v3.oas.annotations.tags.Tag
import org.springframework.http.MediaType
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@Tag(name = DEV_TAG)
@RestController
@RequestMapping(produces = [MediaType.APPLICATION_JSON_VALUE])
class DevGroupScoreResource(
private val groupRankRefreshJob: GroupRankRefreshJob,
) {
@Operation(summary = "group score 갱신")
@PostMapping("/api/dev/v1/group-scores")
suspend fun reloadGroupScores(
dev: DevAuthUser,
) {
groupRankRefreshJob.run()
}
}

0 comments on commit 4ad6baa

Please sign in to comment.