File tree Expand file tree Collapse file tree
apps/commerce-streamer/src/main/java/com/loopers/infrastructure/ranking Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .loopers .infrastructure .ranking ;
2+
3+ import com .loopers .ranking .RankingService ;
4+ import java .time .LocalDate ;
5+ import java .time .ZoneId ;
6+ import lombok .RequiredArgsConstructor ;
7+ import lombok .extern .slf4j .Slf4j ;
8+ import org .springframework .scheduling .annotation .Scheduled ;
9+ import org .springframework .stereotype .Component ;
10+
11+ @ Slf4j
12+ @ Component
13+ @ RequiredArgsConstructor
14+ public class RankingCarryOverScheduler {
15+
16+ private static final ZoneId ZONE_ID = ZoneId .of ("Asia/Seoul" );
17+ private static final double CARRY_OVER_WEIGHT = 0.5d ;
18+
19+ private final RankingService rankingService ;
20+
21+ @ Scheduled (cron = "0 50 23 * * *" , zone = "Asia/Seoul" )
22+ public void carryOverForTomorrow () {
23+ LocalDate tomorrow = LocalDate .now (ZONE_ID ).plusDays (1 );
24+ try {
25+ rankingService .carryOver (tomorrow , CARRY_OVER_WEIGHT );
26+ log .info ("Ranking carry-over completed for date={} weight={}" , tomorrow , CARRY_OVER_WEIGHT );
27+ } catch (Exception exception ) {
28+ log .error ("Ranking carry-over failed for date={}" , tomorrow , exception );
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments