mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
fix(cluster): use for loop instead of _.times
This commit is contained in:
@@ -12,7 +12,9 @@ var cores = +nconf.get('WEB_CONCURRENCY') || 0;
|
|||||||
|
|
||||||
if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
|
if (cores!==0 && cluster.isMaster && (isDev || isProd)) {
|
||||||
// Fork workers. If config.json has CORES=x, use that - otherwise, use all cpus-1 (production)
|
// Fork workers. If config.json has CORES=x, use that - otherwise, use all cpus-1 (production)
|
||||||
_.times(cores, cluster.fork);
|
for (var i = 0, n = cores; i < n; i += 1) {
|
||||||
|
cluster.fork();
|
||||||
|
}
|
||||||
|
|
||||||
cluster.on('disconnect', function(worker, code, signal) {
|
cluster.on('disconnect', function(worker, code, signal) {
|
||||||
var w = cluster.fork(); // replace the dead worker
|
var w = cluster.fork(); // replace the dead worker
|
||||||
|
|||||||
Reference in New Issue
Block a user