https://github.com/component/queue
function job queue with concurrency and timeout support
https://github.com/component/queue
Last synced: 8 months ago
JSON representation
function job queue with concurrency and timeout support
- Host: GitHub
- URL: https://github.com/component/queue
- Owner: component
- Created: 2013-05-20T20:21:27.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2016-02-04T23:41:15.000Z (about 10 years ago)
- Last Synced: 2024-11-17T15:57:11.715Z (over 1 year ago)
- Language: JavaScript
- Size: 13.7 KB
- Stars: 25
- Watchers: 9
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# queue
Task (function) queue with concurrency / timeout control.
## Installation
$ component install component/queue
## Example
```js
var request = require('superagent');
var Queue = require('queue');
var q = new Queue({ concurrency: 3, timeout: 3000 });
var urls = [
'http://google.com',
'http://yahoo.com',
'http://ign.com',
'http://msn.com',
'http://hotmail.com',
'http://cloudup.com',
'http://learnboost.com'
];
urls.forEach(function(url){
q.push(function(fn){
console.log('%s', url);
request.get(url, function(res){
console.log('%s -> %s', url, res.status);
fn();
});
});
});
```
## License
MIT