Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
squash: address code review comments
  • Loading branch information
Eugene Ostroukhov committed Jul 28, 2019
commit 337bc4a53df2822c661c784c0804cb7d7d6e1a3e
21 changes: 11 additions & 10 deletions test/parallel/test-inspector-workers-flat-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,19 @@ const MAX_DEPTH = 3;

let rootWorker = null;

function runTest() {
const runTest = common.mustCall(function() {
let reportedWorkersCount = 0;
const session = new Session();
session.connect();
session.on('NodeWorker.attachedToWorker', ({ params: { workerInfo } }) => {
console.log(`Worker ${workerInfo.title} was reported`);
if (++reportedWorkersCount === MAX_DEPTH) {
rootWorker.postMessage({ done: true });
}
});
session.on('NodeWorker.attachedToWorker', common.mustCall(
({ params: { workerInfo } }) => {
console.log(`Worker ${workerInfo.title} was reported`);
if (++reportedWorkersCount === MAX_DEPTH) {
rootWorker.postMessage({ done: true });
}
}, MAX_DEPTH));
session.post('NodeWorker.enable', { waitForDebuggerOnStart: false });
}
});

function processMessage({ child }) {
console.log(`Worker ${child} is running`);
Expand All @@ -44,7 +45,7 @@ function runMainThread() {
rootWorker = startWorker(1, processMessage);
}

function runWorkerThread() {
function runChildWorkerThread() {
let worker = null;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this to child or childWorker to be more explicit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

parentPort.on('message', ({ child, depth, done }) => {
if (done) {
Expand All @@ -66,5 +67,5 @@ function runWorkerThread() {
if (isMainThread) {
runMainThread();
} else {
runWorkerThread();
runChildWorkerThread();
}