0.1.1 • Published 8 years ago

async-task-runner v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

ASTR

Asynchronous Task Runner - a simple node / angular library for running multiple async tasks and retrieving the results.

The logic behind this library is for situations whereby code needs to make multiple asynchronous calls at once. For instance it is being used in code that regularly scans several files and checks them against an API, which then in turn calls a series of other asynchronous functions with the file data. Each call is quite resource intensive so in order to avoid launching all of the checks at once and exhausting the available memory, this library staggers them so only a set amount are run at any given time (defaults to one at a time).

dependencies

It's dependent on node-uuid, so if you're running it from Angular, make sure node-uuid is loaded first.

usage

Check the test/astr.test.js file for examples, however basic usage is:

var queue = astr.initQueue(); var taskId = queue.add(function(runner) { .. do something fancy here .. runner.done(result); });

.. add more tasks ..

// Execute the queue queue.run(function(results) { // results is a dictionary -- resultstaskId = result });

0.1.1

8 years ago

0.1.0

8 years ago