We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8827c39 commit 20a88f3Copy full SHA for 20a88f3
LiteDB/Client/Storage/LiteFileStream.Read.cs
@@ -62,11 +62,14 @@ private void SetReadStreamPosition(long newPosition)
62
int loadedChunk = _currentChunkIndex;
63
int newChunkIndex = 0;
64
while (seekStreamPosition <= _streamPosition) {
65
- if (!_chunkLengths.ContainsKey(newChunkIndex)) {
+ if (_chunkLengths.TryGetValue(newChunkIndex, out long length)) {
66
+ seekStreamPosition += length;
67
+ }
68
+ else {
69
loadedChunk = newChunkIndex;
70
_currentChunkData = GetChunkData(newChunkIndex);
71
+ seekStreamPosition += _currentChunkData.Length;
72
}
- seekStreamPosition += _chunkLengths[newChunkIndex];
73
newChunkIndex++;
74
75
newChunkIndex--;
0 commit comments