Skip to content

Commit

Permalink
renamed parallelRequests to 'concurrency'
Browse files Browse the repository at this point in the history
  • Loading branch information
Luciano Mammino committed May 9, 2015
1 parent 90bb944 commit c427708
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions flickr-set-get.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ var Flickr = require('./lib/Flickr.js');
//TODO use global apikey in user profile directory
cli.parse({
apiKey: ['k', 'The flickr api key', 'string', require('./.apikey.js')],
parallelRequests: ['p', 'The number of parallel requests', 'number', 5]
concurrency: ['c', 'The number of concurrent requests', 'number', 10]
});

cli.main(function(args, options) {
var api = new Flickr(options.apiKey, options.parallelRequests);
var api = new Flickr(options.apiKey, options.concurrency);
var numPhotos = null;
var numDownloaded = 0;

Expand Down
6 changes: 3 additions & 3 deletions lib/Flickr.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ var download = require('./download.js');

// TODO add support for output folder
// TODO add support to skip already downloaded files
function Flickr(apiKey, parallelRequests) {
function Flickr(apiKey, concurrency) {
var _this = this;

_this.apiKey = apiKey;
_this.parallelRequests = parallelRequests || 5;
_this.concurrency = concurrency || 10;

function parseResponse(error, response, body) {
if (error || response.statusCode !== 200) {
Expand Down Expand Up @@ -87,7 +87,7 @@ function Flickr(apiKey, parallelRequests) {
};
});

async.parallelLimit(tasks, _this.parallelRequests, function(err, results) {
async.parallelLimit(tasks, _this.concurrency, function(err, results) {
_this.emit('done', results);
});
});
Expand Down
6 changes: 3 additions & 3 deletions tests/Flickr.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ describe('Flickr', function() {
f.apiKey.should.equal('apiKey');
});

it('should be initialized with an optional parallelRequest property', function() {
it('should be initialized with an optional concurrency property', function() {
var f = new Flickr('apiKey');
f.parallelRequests.should.be.a('number');
f.concurrency.should.be.a('number');
f = new Flickr('apiKey', 2);
f.parallelRequests.should.equal(2);
f.concurrency.should.equal(2);
});

});
Expand Down

0 comments on commit c427708

Please sign in to comment.