0.0.10 • Published 9 years ago
controlled-cluster v0.0.10
The first world solution to spawning child workers
#Installation ###npm i controlled-cluster --save
#Usage The code below will run three processes in parallel. It is your responsibility to check the number of cpus available.
const controlledCluster = require('controlled-cluster');
const processes = [
  (callback) => {
    console.log("running child process");
    setTimeout(() => {
      //do your work here
      let error = false;
      callback(error)
    }, 1000)
  },
  (callback) => {
    console.log("running child process");
    setTimeout(() => {
      //do your work here
      let error = false;
      callback(error)
    }, 1400)
  },
  (callback) => {
    console.log("running child process")
    setTimeout(() => {
      //do your work here
      let error = false;
      callback(error)
    }, 2000)
  }
];
controlledCluster(processes, (err) => {
  if (!err) {
    console.log("They just toss us away like yesterday's jam.");
  } else {
    console.log(err);
    console.log('Have you tried forcing an unexpected reboot?');
  }
})0.0.10
9 years ago
0.0.9
9 years ago
0.0.8
9 years ago
0.0.7
9 years ago
0.0.6
9 years ago
0.0.5
9 years ago
0.0.4
9 years ago
0.0.3
9 years ago
0.0.2
9 years ago
0.0.1
9 years ago
1.0.8
9 years ago
1.0.7
9 years ago
1.0.6
9 years ago
1.0.5
9 years ago
1.0.4
9 years ago
1.0.3
9 years ago
1.0.2
9 years ago
1.0.1
9 years ago
1.0.0
9 years ago