feat(ngcc): pause async ngcc processing if another process has the lockfile (#35131)

ngcc uses a lockfile to prevent two ngcc instances from executing at the
same time. Previously, if a lockfile was found the current process would
error and exit.

Now, when in async mode, the current process is able to wait for the previous
process to release the lockfile before continuing itself.

PR Close #35131
This commit is contained in:
Pete Bacon Darwin
2020-02-03 20:25:15 +00:00
committed by Alex Rickabaugh
parent 7e8ce24116
commit eef07539a6
10 changed files with 535 additions and 241 deletions

View File

@ -13,7 +13,7 @@ import * as cluster from 'cluster';
import {Logger} from '../../logging/logger';
import {PackageJsonUpdater} from '../../writing/package_json_updater';
import {AnalyzeEntryPointsFn, CreateCompileFn, Executor} from '../api';
import {LockFile} from '../lock_file';
import {LockFileAsync} from '../lock_file';
import {ClusterMaster} from './master';
import {ClusterWorker} from './worker';
@ -26,7 +26,7 @@ import {ClusterWorker} from './worker';
export class ClusterExecutor implements Executor {
constructor(
private workerCount: number, private logger: Logger,
private pkgJsonUpdater: PackageJsonUpdater, private lockFile: LockFile) {}
private pkgJsonUpdater: PackageJsonUpdater, private lockFile: LockFileAsync) {}
async execute(analyzeEntryPoints: AnalyzeEntryPointsFn, createCompileFn: CreateCompileFn):
Promise<void> {