How to use the worker-farm.end function in worker-farm

To help you get started, we’ve selected a few worker-farm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WordPress / gutenberg / bin / packages / build.js View on Github external
if ( error ) {
			// If an error occurs, the process can't be ended immediately since
			// other workers are likely pending. Optimally, it would end at the
			// earliest opportunity (after the current round of workers has had
			// the chance to complete), but this is not made directly possible
			// through `worker-farm`. Instead, ensure at least that when the
			// process does exit, it exits with a non-zero code to reflect the
			// fact that an error had occurred.
			process.exitCode = 1;

			console.error( error );
		}

		if ( ended && ++complete === files.length ) {
			workerFarm.end( worker );
		}
	} ) )
	.on( 'end', () => ended = true )
github electron-userland / electron-builder / test / src / helpers / lint.ts View on Github external
async function main(): Promise {
  const packages = (await fs.readdir(packageDir)).filter(it => !it.includes(".")).sort()
  for (const name of packages) {
    if (name.includes("electron-forge-maker-") || name.includes("electron-installer-")) {
      continue
    }

    workers(path.join(packageDir, name), (error: Error, hasError: boolean) => {
      if (hasError) {
        process.exitCode = 1
      }
    })
  }
  workerFarm.end(workers)
}
github gemini-testing / gemini / lib / state-processor / state-processor.js View on Github external
        emitter.on(Events.END, () => workerFarm.end(this._workers));
    }
github gemini-testing / gemini / lib / image-processor / index.js View on Github external
emitter.on(RunnerEvents.END, function() {
            workerFarm.end(this._workers);
        }.bind(this));
    },
github Fitbit / webpack-cluster / lib / workerFarmRunCompilerStrategy.js View on Github external
WorkerFarmRunCompilerStrategy.prototype.close = function() {
    workerFarm.end(this.workers);
};
github antwarjs / antwar / packages / antwar / src / build / build.js View on Github external
}, function (err) {
      log('Tasks finished');

      workerFarm.end(workers);

      if (err) {
        return reject(err);
      }

      return resolve();
    });
  });
github cliffano / datagen / lib / datagen.js View on Github external
function endWorkerFarm() {
    workerFarm.end(worker);
  }
github jamesshore / automatopia / node_modules / simplebuild-jshint / src / jshint_runner.js View on Github external
function reduceIt(err, results) {
			if (workers) workerFarm.end(workers);
			if (err) return callback(err);

			var pass = results.reduce(function(pass, result) {
				return pass && result;
			}, true);

			process.stdout.write("\n");
			return callback(null, pass);
		}
	};
github Kikobeats / farm-cli / bin / index.js View on Github external
function closeFarm () {
  workerFarm.end(spawnWorker)
}
github d-band / dool / src / cluster.js View on Github external
workers(opt, (err, output) => {
      if (err) {
        log.error(err.stack);
        farm.end(workers);
        callback && callback(err);
        return;
      }
      outs.push(output);
      if (outs.length === entries.length) {
        log.info(outs.join('\n'));
        callback && callback();
        farm.end(workers);
      }
    });
  }

worker-farm

Distribute processing tasks to child processes with an über-simple API and baked-in durability & custom concurrency options.

MIT
Latest version published 6 years ago

Package Health Score

74 / 100
Full package analysis