Skip to content

Commit

Permalink
Add debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed May 16, 2022
1 parent 97cc436 commit 7584140
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
29 changes: 20 additions & 9 deletions eslint/babel-eslint-parser/src/client.cjs
Expand Up @@ -72,18 +72,29 @@ exports.WorkerClient = class WorkerClient extends Client {
[subChannel.port1],
);

Atomics.wait(this.#signal, 0, 0);

let resp;
for (let i = 0; i < 100; i++) {
resp = WorkerClient.#worker_threads.receiveMessageOnPort(
let response;
let i = 0;
// Sometimes receiveMessageOnPort returns "undefined" instead of the
// actual response object. Try multiple times, with a timeout of 5ms
// on Atomic.wait starting from the second one.
do {
const wakeReason = Atomics.wait(
this.#signal,
0,
i === 0 ? Infinity : 5,
);
response = WorkerClient.#worker_threads.receiveMessageOnPort(
subChannel.port2,
);
if (resp) break;
Atomics.wait(this.#signal, 1, 0, 5);
}

const message = resp.message;
if (i > 0 || !response) {
console.log(
`WORKER COMMUNICATION: i=${i}, wakeReason=${wakeReason}, hasResponse=${!!response}`,
);
}
} while (!response && i++ < 100);

const { message } = response;
if (message.error) throw Object.assign(message.error, message.errorData);
else return message.result;
});
Expand Down
6 changes: 5 additions & 1 deletion scripts/integration-tests/e2e-babel.sh
Expand Up @@ -33,6 +33,10 @@ startLocalRegistry "$PWD"/scripts/integration-tests/verdaccio-config.yml
node "$PWD"/scripts/integration-tests/utils/bump-babel-dependencies.js

# Build and test
YARN_ENABLE_IMMUTABLE_INSTALLS=false make -j test-ci
YARN_ENABLE_IMMUTABLE_INSTALLS=false make -j build-standalone-ci
for i in {1..50}; do
echo "RUN NUMBER $i"
BABEL_ENV=test yarn jest --maxWorkers=4 --ci
done

cleanup

0 comments on commit 7584140

Please sign in to comment.