Skip to content

Commit bd7430b

Browse files
committed
fix: better code
1 parent 857ec02 commit bd7430b

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/services/api/streaming.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export class StreamingAPI extends BaseYdbAPI {
8585
if (done) {
8686
break;
8787
}
88-
streamParser.processChunk(value);
88+
streamParser.processBuffer(value);
8989
}
9090
} finally {
9191
reader.releaseLock();

src/services/parsers/parseMultipartStream.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,13 @@ export class MultipartStreamParser {
8484
this.bufferPos = 0;
8585
}
8686

87-
processChunk(chunk: Uint8Array): void {
87+
processBuffer(chunk: Uint8Array): void {
8888
// Append new data to buffer
8989
const newBuffer = new Uint8Array(this.buffer.length + chunk.length);
9090
newBuffer.set(this.buffer);
9191
newBuffer.set(chunk, this.buffer.length);
9292
this.buffer = newBuffer;
9393

94-
this.processBuffer();
95-
}
96-
97-
private processBuffer(): void {
9894
while (this.bufferPos < this.buffer.length) {
9995
const boundaryPos = arrayIndexOf(this.buffer, this.boundaryBytes, this.bufferPos);
10096
if (boundaryPos === -1) {

src/store/reducers/query/query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ interface QueryStats {
259259
endTime?: string | number;
260260
}
261261

262-
const DEFAULT_STREAM_CHUNK_SIZE = 100;
262+
const DEFAULT_STREAM_CHUNK_SIZE = 2;
263263
const DEFAULT_CONCURRENT_RESULTS = false;
264264

265265
export const queryApi = api.injectEndpoints({

0 commit comments

Comments
 (0)