Skip to content

Commit

Permalink
Prevent duplicated cache update [skip changelog]
Browse files Browse the repository at this point in the history
  • Loading branch information
limebell committed Mar 31, 2021
1 parent 86f84b0 commit 242efee
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Libplanet/Net/Protocols/KademliaProtocol.cs
Expand Up @@ -299,16 +299,14 @@ public async Task CheckReplacementCacheAsync(CancellationToken cancellationToken
{
_logger.Verbose("Check peer {Peer}.", replacement);

await PingAsync(replacement, _requestTimeout, cancellationToken);
_table.RemoveCache(replacement);
Update(replacement);
await PingAsync(replacement, _requestTimeout, cancellationToken);
}
catch (PingTimeoutException)
{
_logger.Verbose(
"Remove stale peer {Peer} from replacement cache.",
"Removed stale peer {Peer} from replacement cache.",
replacement);
_table.RemoveCache(replacement);
}
}
}
Expand Down

0 comments on commit 242efee

Please sign in to comment.