Skip to content

Commit fb48d23

Browse files
committed
rename threshold
1 parent 38a92c9 commit fb48d23

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/statement/stream/serverSideStream.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ServerSideStream extends Readable {
1414
private finished = false;
1515
private processingData = false;
1616
private inputPaused = false;
17-
private readonly maxPendingRows = 5; // Limit pending rows to prevent memory buildup
17+
private readonly bufferGrowthThreshold = 10; // Stop adding to buffer when over this many rows are already in
1818
private lineBuffer = "";
1919
private sourceStream: NodeJS.ReadableStream | null = null;
2020

@@ -68,7 +68,7 @@ export class ServerSideStream extends Readable {
6868

6969
// Apply backpressure if we have too many pending rows
7070
if (
71-
this.pendingRows.length > this.maxPendingRows &&
71+
this.pendingRows.length > this.bufferGrowthThreshold &&
7272
this.sourceStream &&
7373
!this.inputPaused &&
7474
!this.processingData
@@ -182,7 +182,7 @@ export class ServerSideStream extends Readable {
182182
if (
183183
this.sourceStream &&
184184
this.inputPaused &&
185-
this.pendingRows.length < this.maxPendingRows / 4
185+
this.pendingRows.length < this.bufferGrowthThreshold
186186
) {
187187
this.sourceStream.resume();
188188
this.inputPaused = false;

0 commit comments

Comments
 (0)