Skip to content

Commit 0fdbe83

Browse files
committed
different backpressure simulation
1 parent 878a660 commit 0fdbe83

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/integration/v2/stream.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,16 @@ describe("streams", () => {
457457
);
458458
}
459459

460-
// Simulate backpressure with 1ms delay every 1000 chunks
460+
// Simulate backpressure with synchronous delay every 1000 chunks
461461
if (processedChunks % 1000 === 0) {
462-
setTimeout(() => {
463-
callback();
464-
}, 1);
465-
} else {
466-
callback();
462+
// Create a small synchronous delay using a busy loop
463+
// This simulates processing time without breaking pipeline completion
464+
const start = Date.now();
465+
while (Date.now() - start < 1) {
466+
// 1ms busy wait
467+
}
467468
}
469+
callback();
468470
} catch (err) {
469471
console.error("[DEBUG] Error in output stream:", err);
470472
callback(err as Error);

0 commit comments

Comments
 (0)