don't increase rate limit when tasks are failing

This commit is contained in:
Brian Gough 2017-06-07 11:47:28 +01:00
parent 1ef258c878
commit 2e5d57cd99

View file

@ -34,5 +34,6 @@ module.exports = class RateLimiter
@_adjustLimitDown()
else
logger.log {active: @ActiveWorkerCount, currentLimit: Math.ceil(@CurrentWorkerLimit)}, "hit rate limit"
@_trackAndRun task, callback # only return after task completes
@_adjustLimitUp()
@_trackAndRun task, (err) =>
@_adjustLimitUp() if !err? # don't increment rate limit if there was an error
callback(err) # only return after task completes