Skip to content

Commit

Permalink
use list
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhangTao1596 committed Feb 1, 2021
1 parent e12ca40 commit 7c85c11
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/StateService/Verification/VerificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,14 @@ private void OnBlockPersisted(uint index)
{
if (MaxCachedVerificationProcessCount <= contexts.Count)
{
var indexes = contexts.Keys.OrderBy(i => i).ToArray();
while (MaxCachedVerificationProcessCount <= indexes.Length)
var indexes = contexts.Keys.OrderBy(i => i).ToList();
while (MaxCachedVerificationProcessCount <= indexes.Count)
{
if (contexts.TryRemove(indexes[0], out var value))
var i = indexes.First();
if (contexts.TryRemove(i, out var value))
{
value.Timer.CancelIfNotNull();
indexes = indexes[..1];
indexes.Remove(i);
}
}
}
Expand Down

0 comments on commit 7c85c11

Please sign in to comment.