Skip to content

Commit 2ae0300

Browse files
clydinfilipesilva
authored andcommitted
refactor(@angular-devkit/build-angular): optimize parallel worker shutdown
Stopping the workers can be a potentially lengthy process with a multi-stage approach based on the state of the worker. This can cause lengthy blocking of the build. This change allows the shutdown to happen in parallel to the remainder of the build.
1 parent 4048e3c commit 2ae0300

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/angular_devkit/build_angular/src/browser/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ export function buildWebpackBrowser(
570570
}
571571
}
572572
} finally {
573-
await executor.stop();
573+
executor.stop();
574574
}
575575

576576
// Copy assets

packages/angular_devkit/build_angular/src/utils/action-executor.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,16 @@ export class BundleActionExecutor {
144144
}
145145
}
146146

147-
async stop(): Promise<void> {
147+
stop(): void {
148+
// Floating promises are intentional here
149+
// https://github.com/facebook/jest/tree/56079a5aceacf32333089cea50c64385885fee26/packages/jest-worker#end
148150
if (this.largeWorker) {
149-
await this.largeWorker.end();
151+
// tslint:disable-next-line: no-floating-promises
152+
this.largeWorker.end();
150153
}
151154
if (this.smallWorker) {
152-
await this.smallWorker.end();
155+
// tslint:disable-next-line: no-floating-promises
156+
this.smallWorker.end();
153157
}
154158
}
155159
}

packages/angular_devkit/build_angular/src/utils/i18n-inlining.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export async function i18nInlineEmittedFiles(
112112

113113
return false;
114114
} finally {
115-
await executor.stop();
115+
executor.stop();
116116
}
117117

118118
if (hasErrors) {

0 commit comments

Comments
 (0)