Skip to content

Commit

Permalink
Delete score caching
Browse files Browse the repository at this point in the history
  • Loading branch information
ipdae committed Sep 9, 2024
1 parent 66d470a commit 3a13b79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
1 change: 0 additions & 1 deletion ArenaService/ArenaService/ArenaWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ public async Task PrepareArenaParticipants()
var avatarAddrAndScoresWithRank = await _rpcClient.AvatarAddrAndScoresWithRank(tip, avatarAddrList, currentRoundData);
var result = await _rpcClient.GetArenaParticipants(tip, avatarAddrList, avatarAddrAndScoresWithRank);
await _service.SetArenaParticipantsAsync(cacheKey, result, expiry);
await _service.SetAvatarAddrAndScoresWithRank(scoreCacheKey, avatarAddrAndScoresWithRank, expiry);
await _service.SetSeasonAsync(cacheKey, expiry);
sw.Stop();
_logger.LogInformation("[ArenaParticipantsWorker]Set Arena Cache[{CacheKey}]: {Elapsed}", cacheKey, sw.Elapsed);
Expand Down
7 changes: 3 additions & 4 deletions ArenaService/ArenaService/StateQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,11 @@ public StateQuery(IRedisArenaParticipantsService redisArenaParticipantsService)
return result;
}

var scores = await redisArenaParticipantsService1.GetAvatarAddrAndScoresWithRank($"{cacheKey}_score");
var avatarScore = scores.FirstOrDefault(r => r.AvatarAddr == currentAvatarAddr);
if (avatarScore?.Score > 0)
var cached = await redisArenaParticipantsService1.GetArenaParticipantsAsync(cacheKey);
var avatarScore = cached.FirstOrDefault(r => r.AvatarAddr == currentAvatarAddr).Score;
if (avatarScore > 0)
{
playerScore = avatarScore.Score;
playerScore = avatarScore;
}
foreach (var arenaParticipant in cached)
{
Expand Down

0 comments on commit 3a13b79

Please sign in to comment.