@@ -94,15 +94,19 @@ export class DataSchemaCompiler {
9494 const errorsReport = new ErrorReporter ( null , [ ] , this . errorReport ) ;
9595 this . errorsReport = errorsReport ;
9696
97- if ( getEnv ( 'workerThreadsTranspilation' ) ) {
98- this . workerPool = workerpool . pool ( path . join ( __dirname , 'transpilers/transpiler_worker' ) ) ;
97+ if ( getEnv ( 'transpilationWorkerThreads' ) ) {
98+ const wc = getEnv ( 'transpilationWorkerThreadsCount' ) ;
99+ this . workerPool = workerpool . pool (
100+ path . join ( __dirname , 'transpilers/transpiler_worker' ) ,
101+ wc > 0 ? { maxWorkers : wc } : undefined ,
102+ ) ;
99103 }
100104
101105 const transpile = async ( ) => {
102106 let cubeNames ;
103107 let cubeSymbolsNames ;
104108
105- if ( getEnv ( 'workerThreadsTranspilation ' ) ) {
109+ if ( getEnv ( 'transpilationWorkerThreads ' ) ) {
106110 cubeNames = Object . keys ( this . cubeDictionary . byId ) ;
107111 // We need only cubes and all its member names for transpiling.
108112 // Cubes doesn't change during transpiling, but are changed during compilation phase,
@@ -119,16 +123,8 @@ export class DataSchemaCompiler {
119123 ) ,
120124 ) ;
121125 }
122- // const results = await Promise.all(toCompile.map(f => this.transpileFile(f, errorsReport, { cubeNames, cubeSymbolsNames })));
123- const results = [ ] ;
124- for ( const f of toCompile ) {
125- const result = await this . transpileFile ( f , errorsReport , { cubeNames, cubeSymbolsNames } ) ;
126- if ( result ) {
127- results . push ( result ) ;
128- }
129- }
130- // return results.filter(f => !!f);
131- return results ;
126+ const results = await Promise . all ( toCompile . map ( f => this . transpileFile ( f , errorsReport , { cubeNames, cubeSymbolsNames } ) ) ) ;
127+ return results . filter ( f => ! ! f ) ;
132128 } ;
133129
134130 const compilePhase = async ( compilers ) => this . compileCubeFiles ( compilers , await transpile ( ) , errorsReport ) ;
@@ -189,7 +185,7 @@ export class DataSchemaCompiler {
189185
190186 async transpileJsFile ( file , errorsReport , { cubeNames, cubeSymbolsNames } ) {
191187 try {
192- if ( getEnv ( 'workerThreadsTranspilation ' ) ) {
188+ if ( getEnv ( 'transpilationWorkerThreads ' ) ) {
193189 const data = {
194190 fileName : file . fileName ,
195191 content : file . content ,
0 commit comments