   @HIGH: 2
   @VERY_HIGH: 3
 
-  constructor: ->
+  constructor: (@workerCount=1) ->
     @jobs = []
-    @currentJob = null
+    @runningJobs = []
     @_emitter = new Emitter
 
   enqueue: (request, priority) ->

  off: (args...) -> @_emitter.off args...

  _checkQueue: ->
    return if @currentJob

    @currentJob = @_dequeue()
    @_emitter.emit "start", @currentJob

    request = @currentJob.request
    request.on "complete", @_requestComplete.bind(this)
    request.send()

  _dequeue: ->
    return null if @jobs.length is 0


    false

  _jobComplete: (job) ->
    @_emitter.emit "finish", job

    index = @runningJobs.indexOf(job)
    @runningJobs.splice(index, 1)

    @_checkQueue()
