Skip to content

Commit

Permalink
fix: eslint-parser worker
Browse files Browse the repository at this point in the history
  • Loading branch information
liuxingbaoyu authored and nicolo-ribaudo committed May 17, 2022
1 parent 060e983 commit c201157
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions eslint/babel-eslint-parser/src/client.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ exports.WorkerClient = class WorkerClient extends Client {
{ env: WorkerClient.#worker_threads.SHARE_ENV },
);

#signal = new Int32Array(new SharedArrayBuffer(4));
#signal = new Int32Array(new SharedArrayBuffer(8));

constructor() {
super((action, payload) => {
Expand All @@ -73,10 +73,17 @@ exports.WorkerClient = class WorkerClient extends Client {
);

Atomics.wait(this.#signal, 0, 0);
const { message } = WorkerClient.#worker_threads.receiveMessageOnPort(
subChannel.port2,
);

let resp;
for (let i = 0; i < 100; i++) {
resp = WorkerClient.#worker_threads.receiveMessageOnPort(
subChannel.port2,
);
if (resp) break;
Atomics.wait(this.#signal, 1, 0, 30);
}

const message = resp.message;
if (message.error) throw Object.assign(message.error, message.errorData);
else return message.result;
});
Expand Down

0 comments on commit c201157

Please sign in to comment.