Skip to content

Commit

Permalink
fix(core): make plugin pool cleanup to be synchronous (#26389)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored Jun 5, 2024
1 parent fcb6498 commit 3ff1b5b
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions packages/nx/src/project-graph/plugins/isolation/plugin-pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function loadRemoteNxPlugin(

const cleanupFunction = () => {
worker.off('exit', exitHandler);
shutdownPluginWorker(worker, pendingPromises);
shutdownPluginWorker(worker);
};

cleanupFunctions.add(cleanupFunction);
Expand All @@ -75,21 +75,12 @@ export function loadRemoteNxPlugin(
});
}

async function shutdownPluginWorker(
worker: ChildProcess,
pendingPromises: Map<string, PendingPromise>
) {
function shutdownPluginWorker(worker: ChildProcess) {
// Clears the plugin cache so no refs to the workers are held
nxPluginCache.clear();

// logger.verbose(`[plugin-pool] starting worker shutdown`);

// Other things may be interacting with the worker.
// Wait for all pending promises to be done before killing the worker
await Promise.all(
Array.from(pendingPromises.values()).map(({ promise }) => promise)
);

worker.kill('SIGINT');
}

Expand Down

0 comments on commit 3ff1b5b

Please sign in to comment.