Have ideas to improve npm?Join in the discussion! »

    node-process-pool

    0.6.1 • Public • Published

    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()

    Install

    npm i node-process-pool

    DownloadsWeekly Downloads

    2

    Version

    0.6.1

    License

    MIT

    Unpacked Size

    10.9 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar