Skip to content

Commit

Permalink
fix(js): node executor address already in use (#14023)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil Purav committed Dec 27, 2022
1 parent d3ef0ea commit 4c5a139
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/js/src/executors/node/node.impl.ts
Expand Up @@ -15,7 +15,7 @@ import { InspectType, NodeExecutorOptions } from './schema';

const hasher = new HashingImpl();
const processMap = new Map<string, ChildProcess>();
const hashedMap = new Map<string[], string>();
const hashedMap = new Map<string, string>();

export interface ExecutorEvent {
outfile: string;
Expand Down Expand Up @@ -92,7 +92,7 @@ async function runProcess(

const hashed = hasher.hashArray(execArgv.concat(options.args));

const hashedKey = [uniqueKey, ...options.args];
const hashedKey = JSON.stringify([uniqueKey, ...options.args]);
hashedMap.set(hashedKey, hashed);

const subProcess = fork(
Expand Down Expand Up @@ -166,7 +166,7 @@ async function killCurrentProcess(
options: NodeExecutorOptions,
signal: string = 'SIGTERM'
) {
const hashedKey = [uniqueKey, ...options.args];
const hashedKey = JSON.stringify([uniqueKey, ...options.args]);
const currentProcessKey = hashedMap.get(hashedKey);
if (!currentProcessKey) return;

Expand Down

0 comments on commit 4c5a139

Please sign in to comment.