async-forkqueue
a queue that runs workers asynchronously in child processes
Last updated 7 years ago by azylman .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install async-forkqueue 
SYNC missed versions from official npm registry.

Async-ForkQueue

Async-ForkQueue is based on ForkQueue, but it allows setting a level of concurrency where each forked process will run that many at a time and provides a api for creating worker functions.

Install

  npm install async-forkqueue

API

var Queue = require('async-forkqueue');
var num_workers = 4;
var concurrency = 4;

var queue = new Queue num_workers, concurrency, module_path

for (var i = 0; i < 100; i++) {
  queue.push(i);
}

queue.end(callback);

Worker modules

Worker modules are spawned with child_process.fork.

A simple worker is below.

module.exports = function (payload, cb) {
  // Do something with the payload
  cb()
}

Current Tags

  • 0.1.4                                ...           latest (7 years ago)

5 Versions

  • 0.1.4                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 6
Last Day 1
Last Week 1
Last Month 0
Dependencies (3)
Dev Dependencies (1)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |