Skip to content

Commit

Permalink
Method to set concurrency level.
Browse files Browse the repository at this point in the history
  • Loading branch information
titarenko committed Dec 28, 2013
1 parent 5560efd commit f60ef5c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modules/Api.coffee
Expand Up @@ -7,12 +7,15 @@ HtmlProcessor = require "./HtmlProcessor"

module.exports = class Api

@concurrency: 100

constructor: (@root) ->
@_emitter = new events.EventEmitter
@_done = []
@_total = []
@_concurrency = 100

concurrency: (value) ->
@_concurrency = value
@

json: (uri) ->
@_download "json", uri
Expand All @@ -33,7 +36,7 @@ module.exports = class Api
.then((value) -> done null, value)
.catch((error) -> done error)
@_promise = @_promise.then (value) =>
Api._Map(value, Api.concurrency, mapper.bind @).then Q.all
Api._Map(value, @_concurrency, mapper.bind @).then Q.all
@

flatten: ->
Expand Down

0 comments on commit f60ef5c

Please sign in to comment.