feat(content-ranking): 스냅샷 갱신에 공개 시각을 반영한다

This commit is contained in:
2026-06-24 23:46:40 +09:00
parent f2ea82f4a4
commit 30b687737e
2 changed files with 26 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ package kr.co.vividnext.sodalive.v2.ranking.application
import kr.co.vividnext.sodalive.v2.ranking.domain.CreatorRankingPeriodPolicy
import kr.co.vividnext.sodalive.v2.ranking.domain.CreatorRankingScorePolicy
import kr.co.vividnext.sodalive.v2.ranking.domain.CreatorRankingSnapshotCandidate
import kr.co.vividnext.sodalive.v2.ranking.domain.CreatorRankingType
import kr.co.vividnext.sodalive.v2.ranking.domain.CreatorRankingUtcRange
import kr.co.vividnext.sodalive.v2.ranking.port.out.CreatorRankingAggregationPort
import kr.co.vividnext.sodalive.v2.ranking.port.out.CreatorRankingAggregationResult
@@ -29,6 +30,7 @@ class CreatorRankingSnapshotRefreshService(
val startedAt = System.currentTimeMillis()
val period = periodPolicy.resolveLastCompletedWeek(now)
val utcRange = periodPolicy.toUtcRange(period)
val visibleFromAtUtc = periodPolicy.resolveVisibleFromAtUtc(period.endExclusiveKst)
runCatching {
val aggregationResult = aggregationPort.aggregateCandidateResult(
startInclusiveUtc = utcRange.startInclusiveUtc,
@@ -39,8 +41,10 @@ class CreatorRankingSnapshotRefreshService(
.takeRankedBoundary(limit = SNAPSHOT_LIMIT)
snapshotPort.replaceSnapshots(
rankingType = CreatorRankingType.WEEKLY,
aggregationStartAtUtc = utcRange.startInclusiveUtc,
aggregationEndAtUtc = utcRange.endExclusiveUtc,
visibleFromAtUtc = visibleFromAtUtc,
newSnapshots = snapshots
)
aggregationResult.toLogCounts(storedCount = snapshots.size)
@@ -124,8 +128,10 @@ class CreatorRankingSnapshotRefreshService(
)
return CreatorRankingSnapshotRecord(
rankingType = CreatorRankingType.WEEKLY,
aggregationStartAtUtc = utcRange.startInclusiveUtc,
aggregationEndAtUtc = utcRange.endExclusiveUtc,
visibleFromAtUtc = utcRange.endExclusiveUtc.plusHours(9),
creatorId = creatorId,
nickname = nickname,
profileImageUrl = profileImageUrl,