Skip to content

Commit

Permalink
prevent 'one-plan' loop in shiftJobs
Browse files Browse the repository at this point in the history
  • Loading branch information
afelix committed May 4, 2012
1 parent 05aea89 commit 4fb88de
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/workers.js
Expand Up @@ -149,15 +149,17 @@ module.exports = INHERIT({
*/
shiftJobFromPlans: function(id) {
var plan = this.nextOperablePlan(),
startId = plan && plan.getId();
startId = plan && plan.getId(),
donePlans = {};

if (startId) {
do {
if (plan.nextJob(id)) {
this.addFinishListener(id, plan.getId());
}
donePlans[plan.getId()] = 1;
plan = this.nextOperablePlan();
} while (plan && plan.getId() !== startId);
} while (plan && !donePlans[plan.getId()]);
}
},

Expand Down

0 comments on commit 4fb88de

Please sign in to comment.