Skip to content

Commit

Permalink
use fixed size for buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
pictos committed Jun 14, 2024
1 parent d559729 commit dd063ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions LiteDB/Engine/Engine/Upgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ private void TryUpgrade()
// if file not exists, just exit
if (!File.Exists(filename)) return;

var buffer = _bufferPool.Rent(1024);
const int bufferSize = 1024;
var buffer = _bufferPool.Rent(bufferSize);

using (var stream = new FileStream(
_settings.Filename,
FileMode.Open,
FileAccess.Read,
FileShare.Read, 1024))
FileShare.Read, bufferSize))
{


stream.Position = 0;
stream.Read(buffer, 0, buffer.Length);
stream.Read(buffer, 0, bufferSize);

if (FileReaderV7.IsVersion(buffer) == false) return;
}
Expand Down

0 comments on commit dd063ef

Please sign in to comment.