@@ -41,9 +41,8 @@ function UglifyWriter (inputNodes, options) {
4141 } ) ;
4242
4343 // consumers of this plugin can opt-in to async and concurrent behavior
44- // TODO docs in the README
4544 this . async = ( this . options . async === true ) ;
46- this . concurrency = this . options . concurrency || Number ( process . env . JOBS ) || Math . max ( require ( 'os' ) . cpus ( ) . length - 1 , 1 ) ;
45+ this . concurrency = Number ( process . env . JOBS ) || this . options . concurrency || Math . max ( require ( 'os' ) . cpus ( ) . length - 1 , 1 ) ;
4746
4847 // create a worker pool using an external worker script
4948 this . pool = workerpool . pool ( path . join ( __dirname , 'lib' , 'worker.js' ) , { maxWorkers : this . concurrency } ) ;
@@ -118,8 +117,10 @@ UglifyWriter.prototype.build = function () {
118117UglifyWriter . prototype . processFile = function ( inFile , outFile , relativePath , outDir ) {
119118 // don't run this in the workerpool if concurrency is disabled (can set JOBS <= 1)
120119 if ( this . async && this . concurrency > 1 ) {
120+ debug ( 'running in workerpool, concurrency=%d' , this . concurrency ) ;
121121 // each of these arguments is a string, which can be sent to the worker process as-is
122122 return this . pool . exec ( 'processFileParallel' , [ inFile , outFile , relativePath , outDir , silent , this . options ] ) ;
123123 }
124+ debug ( 'not running in workerpool' ) ;
124125 return processFile ( inFile , outFile , relativePath , outDir , silent , this . options ) ;
125126} ;
0 commit comments