Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

quargo

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

quargo

Queued cargo, with load optimization

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Quargo

A mix of async’s queue and cargo, with capacity optimization.

StructureTasks per worker (capacity)Workers per structure (concurrency)
queue1x
cargoy1
quargoyx
var queue = async.queue(worker, concurrency);
var cargo = async.cargo(function(tasks, callback) {
    queue.push(tasks);
    callback();
}, capacity);

cargo.push('a task')

quargo(worker, [capacity, [concurrency, [delay]]])

Creates a quargo object with the specified capacity, concurrency and delay. Tasks added to the quargo will be processed altogether (up to the capacity limit) in parallel batches (up to the concurrency limit). If all workers are in progress, the task is queued until one becomes available. If the quargo hasn’t reached capacity, the task is queued for maximum delay. Once a worker has completed some tasks, each callback of those tasks is called.

Quargo passes an array of tasks to one of a group of workers, repeating when the worker is finished.

Arguments
  • worker(tasks, callback) - An asynchronous function for processing an array of queued tasks, which must call its callback(err) argument when finished, with an optional err argument.
  • capacity - An optional integer for determining how many tasks should be processed per round; if omitted, the default is unlimited.
  • concurrency - An optional integer for determining how many worker functions should be run in parallel; if omitted, the default is 1.
  • delay - An optional integer for determining how long should the quargo wait to reach capacity; if omitted, the default is 0.
Quargo objects

The quargo object returned has the following properties and methods:

  • length() - a function returning the number of items waiting to be processed.

FAQs

Package last updated on 31 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc