Skip to content

Commit

Permalink
Merge pull request #2318 from planetarium/release/72-worker-test
Browse files Browse the repository at this point in the history
detailed log arena list worker
  • Loading branch information
ipdae authored Nov 21, 2023
2 parents 78e9be3 + 3b814a7 commit 1fdd655
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions NineChronicles.Headless/ArenaParticipantsWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,26 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
catch (OperationCanceledException)
{
//pass
_logger.Information("[ArenaParticipantsWorker]Cancel ArenaParticipantsWorker");
}
catch (Exception)
catch (Exception e)
{
_logger.Warning("Stopping ArenaParticipantsWorker");
_logger.Error(e, "[ArenaParticipantsWorker]Stopping ArenaParticipantsWorker");
await StopAsync(stoppingToken);
}
}

public void GetArenaParticipants()
{
_logger.Information("[ArenaParticipantsWorker]Start Sync Arena Cache");
var sw = new Stopwatch();
sw.Start();
// Copy from NineChronicles RxProps.Arena
// https://github.com/planetarium/NineChronicles/blob/80.0.1/nekoyume/Assets/_Scripts/State/RxProps.Arena.cs#L279
var blockChain = _context.BlockChain;
if (blockChain is null)
{
_logger.Warning("[ArenaParticipantsWorker]BlockChain is null");
throw new Exception();
}

Expand All @@ -86,6 +89,7 @@ public void GetArenaParticipants()
if (participants is null)
{
_cache.ArenaParticipantsCache.Set(cacheKey, new List<ArenaParticipant>());
_logger.Information("[ArenaParticipantsWorker] participants({CacheKey}) is null. set empty list", cacheKey);
return;
}

Expand Down Expand Up @@ -273,6 +277,6 @@ List runeSlotList
}).ToList();
_cache.ArenaParticipantsCache.Set(cacheKey, result, TimeSpan.FromHours(1));
sw.Stop();
_logger.Information("Set Arena Cache[{CacheKey}]: {Elapsed}", cacheKey, sw.Elapsed);
_logger.Information("[ArenaParticipantsWorker]Set Arena Cache[{CacheKey}]: {Elapsed}", cacheKey, sw.Elapsed);
}
}

0 comments on commit 1fdd655

Please sign in to comment.