Skip to content

Commit

Permalink
Update test/parallel/test-whatwg-webstreams-transfer.js
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell authored Dec 22, 2023
1 parent 2ac4765 commit 1e4d84b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/parallel/test-whatwg-webstreams-transfer.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,13 @@ const theData = 'hello';
});
// We create an interval to keep the event loop alive while
// we wait for the stream read to complete.
// we wait for the stream read to complete. The reason this is needed is because there's
// otherwise nothing to keep the worker thread event loop alive long enough to actually
// complete the read from the stream. Under the covers the ReadableStream uses an
// unref'd MessagePort to communicate with the main thread. Because the MessagePort
// is unref'd, it's existence would not keep the thread alive on its own. There was previously
// a bug where this MessagePort was ref'd which would block the thread and main thread
// from terminating at all unless the stream was consumed/closed.
const i = setInterval(() => {}, 1000);
parentPort.onmessage = tracker.calls(({ data }) => {
Expand Down

0 comments on commit 1e4d84b

Please sign in to comment.