0.6.1 • Published 5 years ago

node-process-pool v0.6.1

Weekly downloads
13
License
MIT
Repository
github
Last release
5 years ago

Node Process Pool

If you want to learn more, please visit ProcessPool in github.

Installation

npm install node-process-pool

Usage

// Process pool usage example
const ProcessPool = require('node-process-pool')
const taskParams = []
for (let i = 0; i < 5000; i++) {
  taskParams[i] = [i]
}
// Create a process pool instance
const processPool = new ProcessPool({
  maxParallelProcess: 50, // Supports maximum number of process parallelism
  timeToClose: 60 * 1000, // The maximum time for a single task to be executed
  dependency: `const path = require('path')`, // task script dependencies
  workDir: __dirname, // current directory
  taskName: 'test', // task script name
  script: async function task(taskParams) {
    console.log(taskParams)
  },
  taskParams // Need to perform the task parameter list, two-dimensional array
})
// Process pools are used to handle large scale tasks
processPool.run()
0.6.1

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago