diff --git a/ArenaService/ArenaService/ArenaWorker.cs b/ArenaService/ArenaService/ArenaWorker.cs index bc70fd3..a4a2eeb 100644 --- a/ArenaService/ArenaService/ArenaWorker.cs +++ b/ArenaService/ArenaService/ArenaWorker.cs @@ -84,13 +84,13 @@ public async Task PrepareArenaParticipants() // 전체목록의 랭킹 순서 처리 var avatarAddrAndScoresWithRank = AvatarAddrAndScoresWithRank(avatarAddrAndScores); // 전체목록의 ArenaParticipant 업데이트 - var result = await _rpcClient.GetArenaParticipants(tip, championshipId, round, updatedAddressAndScores.Select(i => i.AvatarAddr).ToList(), avatarAddrAndScoresWithRank, prevArenaParticipants, cancellationToken); + var tuple = await _rpcClient.GetArenaParticipants(tip, championshipId, round, updatedAddressAndScores.Select(i => i.AvatarAddr).ToList(), avatarAddrAndScoresWithRank, prevArenaParticipants, cancellationToken); // 캐시 업데이트 - await _service.SetArenaParticipantsAsync(cacheKey, result, expiry); + await _service.SetArenaParticipantsAsync(cacheKey, tuple.Item1, expiry); await _service.SetSeasonAsync(cacheKey, expiry); await _service.SetAvatarAddrAndScores(scoreCacheKey, avatarAddrAndScores, expiry); sw.Stop(); - _logger.LogInformation("[ArenaParticipantsWorker]Set Arena Cache[{CacheKey}] on {BlockIndex}: {Elapsed}", cacheKey, blockIndex, sw.Elapsed); + _logger.LogInformation("[ArenaParticipantsWorker]Set Arena Cache[{CacheKey}] on {BlockIndex}/{LatestBattleBlockIndex}: {Elapsed}", cacheKey, blockIndex, tuple.Item2, sw.Elapsed); } diff --git a/ArenaService/ArenaService/RpcClient.cs b/ArenaService/ArenaService/RpcClient.cs index 616a727..0e06ca5 100644 --- a/ArenaService/ArenaService/RpcClient.cs +++ b/ArenaService/ArenaService/RpcClient.cs @@ -286,8 +286,8 @@ public async Task> GetAvatarAddrAndScores(Block bloc /// The list of avatar addresses with their scores and ranks. /// The list of previous synced arena participants. if the score has not changed, is reused. /// - /// A list of arena participants. - public async Task> GetArenaParticipants(Block block, int championshipId, int round, List
avatarAddrList, + /// A list of arena participants and latest RankingBattle executed block index. + public async Task<(List, long)> GetArenaParticipants(Block block, int championshipId, int round, List
avatarAddrList, List avatarAddrAndScoresWithRank, List prevArenaParticipants, CancellationToken cancellationToken) { @@ -297,6 +297,9 @@ public async Task> GetArenaParticipants(Block block } var arenaParticipantStates = await GetArenaParticipantStates(block, championshipId, round, avatarAddrList, cancellationToken); + var latestBlockIndex = arenaParticipantStates.Count > 0 + ? arenaParticipantStates.Values.Max(i => i.LastBattleBlockIndex) + : 0L; var tasks = avatarAddrAndScoresWithRank.Select(async tuple => { if (cancellationToken.IsCancellationRequested) @@ -336,7 +339,7 @@ public async Task> GetArenaParticipants(Block block ); }).ToList(); var result = await Task.WhenAll(tasks); - return result.ToList(); + return (result.ToList(), latestBlockIndex); } ///