From 063188b5041f009e48ed8862de54be0d3374c348 Mon Sep 17 00:00:00 2001 From: sakno Date: Mon, 10 Jun 2024 09:52:34 +0300 Subject: [PATCH] Code cleanup --- .../Net/Cluster/Consensus/Raft/PersistentState.Partition.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs index 3ccd30728..9969baa9c 100644 --- a/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs +++ b/src/cluster/DotNext.Net.Cluster/Net/Cluster/Consensus/Raft/PersistentState.Partition.cs @@ -567,7 +567,7 @@ protected override async ValueTask PersistAsync(TEntry entry, int index, await UnsealIfNeededAsync(writeAddress, token).ConfigureAwait(false); LogEntryMetadata metadata; - Memory metadataBuffer; + var metadataBuffer = GetMetadataBuffer(index); var startPos = writeAddress + LogEntryMetadata.Size; if (entry.Length is { } length) { @@ -578,7 +578,6 @@ protected override async ValueTask PersistAsync(TEntry entry, int index, await writer.WriteAsync(metadata, token).ConfigureAwait(false); await entry.WriteToAsync(writer, token).ConfigureAwait(false); - metadataBuffer = GetMetadataBuffer(index); metadata.Format(metadataBuffer.Span); } else @@ -590,7 +589,6 @@ protected override async ValueTask PersistAsync(TEntry entry, int index, length = writer.WritePosition - startPos; metadata = LogEntryMetadata.Create(entry, startPos, length); - metadataBuffer = GetMetadataBuffer(index); metadata.Format(metadataBuffer.Span); await RandomAccess.WriteAsync(Handle, metadataBuffer, writeAddress, token).ConfigureAwait(false); }