File tree Expand file tree Collapse file tree 7 files changed +26
-2
lines changed
packages/angular_devkit/build_angular/src Expand file tree Collapse file tree 7 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ async function _renderUniversal(
123
123
}
124
124
}
125
125
} finally {
126
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
127
+ renderWorker . options . minThreads = 0 ;
128
+
126
129
await renderWorker . destroy ( ) ;
127
130
}
128
131
Original file line number Diff line number Diff line change @@ -244,6 +244,8 @@ async function _renderUniversal(
244
244
}
245
245
}
246
246
} finally {
247
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
248
+ worker . options . minThreads = 0 ;
247
249
void worker . destroy ( ) ;
248
250
}
249
251
Original file line number Diff line number Diff line change @@ -144,6 +144,9 @@ export class I18nInliner {
144
144
* @returns A void promise that resolves when closing is complete.
145
145
*/
146
146
close ( ) : Promise < void > {
147
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
148
+ this . #workerPool. options . minThreads = 0 ;
149
+
147
150
return this . #workerPool. destroy ( ) ;
148
151
}
149
152
}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export class JavaScriptTransformer {
32
32
constructor ( options : JavaScriptTransformerOptions , maxThreads : number ) {
33
33
this . #workerPool = new Piscina ( {
34
34
filename : require . resolve ( './javascript-transformer-worker' ) ,
35
+ minThreads : 1 ,
35
36
maxThreads,
36
37
} ) ;
37
38
@@ -102,6 +103,9 @@ export class JavaScriptTransformer {
102
103
* @returns A void promise that resolves when closing is complete.
103
104
*/
104
105
close ( ) : Promise < void > {
106
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
107
+ this . #workerPool. options . minThreads = 0 ;
108
+
105
109
return this . #workerPool. destroy ( ) ;
106
110
}
107
111
}
Original file line number Diff line number Diff line change @@ -231,6 +231,8 @@ export class JavaScriptOptimizerPlugin {
231
231
232
232
await Promise . all ( tasks ) ;
233
233
} finally {
234
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
235
+ workerPool . options . minThreads = 0 ;
234
236
void workerPool . destroy ( ) ;
235
237
}
236
238
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ export class BundleActionExecutor {
64
64
}
65
65
66
66
stop ( ) : void {
67
- void this . workerPool ?. destroy ( ) ;
67
+ if ( this . workerPool ) {
68
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
69
+ this . workerPool . options . minThreads = 0 ;
70
+ void this . workerPool . destroy ( ) ;
71
+ }
68
72
}
69
73
}
Original file line number Diff line number Diff line change @@ -144,6 +144,8 @@ export async function prerenderPages(
144
144
145
145
await Promise . all ( renderingPromises ) ;
146
146
} finally {
147
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
148
+ renderWorker . options . minThreads = 0 ;
147
149
void renderWorker . destroy ( ) ;
148
150
}
149
151
@@ -208,7 +210,11 @@ async function getAllRoutes(
208
210
209
211
const { routes : extractedRoutes , warnings } : RoutersExtractorWorkerResult = await renderWorker
210
212
. run ( { } )
211
- . finally ( ( ) => void renderWorker . destroy ( ) ) ;
213
+ . finally ( ( ) => {
214
+ // Workaround piscina bug where a worker thread will be recreated after destroy to meet the minimum.
215
+ renderWorker . options . minThreads = 0 ;
216
+ void renderWorker . destroy ( ) ;
217
+ } ) ;
212
218
213
219
for ( const route of extractedRoutes ) {
214
220
routes . add ( route ) ;
You can’t perform that action at this time.
0 commit comments