diff --git a/CHANGES.md b/CHANGES.md index 6735aeb9c1..98665f36f4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,8 +11,11 @@ To be released. - (Libplanet.Net) `GossipConsensusMessageCommunicator` now filters `ConsensusVoteMsg` which height is different from latest `Context`. [[#3519]] + - (Libplanet.Action) Fixed a bug where initialization of `AccountMetrics` + is absent. [[#3521]] [#3519]: https://github.com/planetarium/libplanet/pull/3519 +[#3521]: https://github.com/planetarium/libplanet/pull/3521 Version 3.8.0 diff --git a/Libplanet.Action/AccountMetrics.cs b/Libplanet.Action/AccountMetrics.cs index 94e5cd0438..e781085932 100644 --- a/Libplanet.Action/AccountMetrics.cs +++ b/Libplanet.Action/AccountMetrics.cs @@ -7,5 +7,11 @@ public static class AccountMetrics { public static readonly AsyncLocal GetStateTimer = new AsyncLocal(); public static readonly AsyncLocal GetStateCount = new AsyncLocal(); + + public static void Initialize() + { + GetStateTimer.Value = new Stopwatch(); + GetStateCount.Value = 0; + } } } diff --git a/Libplanet.Action/ActionEvaluator.cs b/Libplanet.Action/ActionEvaluator.cs index 5a43f0d1b2..d30129c674 100644 --- a/Libplanet.Action/ActionEvaluator.cs +++ b/Libplanet.Action/ActionEvaluator.cs @@ -249,6 +249,7 @@ IActionContext CreateActionContext(IAccount newPrevState) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); + AccountMetrics.Initialize(); state = feeCollector.Mortgage(state); context = CreateActionContext(state); feeCollector = feeCollector.Next(context);