Skip to content

Commit

Permalink
limit accumulation of any particular job
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Gregson committed Jan 30, 2016
1 parent 8b2ea5b commit 5d0278c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/agenda.js
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,13 @@ function processJobs(extraJob) {

if (jobs) {
enqueueJobs(jobs);
if(jobQueue.length < 2*self._maxConcurrency)
var jobOccurrenceCount = 0;
jobQueue.forEach(function(queued_job){
if(queued_job.name === name)
jobOccurrenceCount++;
});
if(jobQueue.length < 2*self._maxConcurrency &&
jobOccurrenceCount < definitions[name].concurrency)
jobQueueFilling(name);
jobProcessing();
}
Expand Down

0 comments on commit 5d0278c

Please sign in to comment.