Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sakno committed Jun 10, 2024
1 parent 6be595d commit 063188b
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ protected override async ValueTask PersistAsync<TEntry>(TEntry entry, int index,
await UnsealIfNeededAsync(writeAddress, token).ConfigureAwait(false);

LogEntryMetadata metadata;
Memory<byte> metadataBuffer;
var metadataBuffer = GetMetadataBuffer(index);
var startPos = writeAddress + LogEntryMetadata.Size;
if (entry.Length is { } length)
{
Expand All @@ -578,7 +578,6 @@ protected override async ValueTask PersistAsync<TEntry>(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
Expand All @@ -590,7 +589,6 @@ protected override async ValueTask PersistAsync<TEntry>(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);
}
Expand Down

0 comments on commit 063188b

Please sign in to comment.