lib/fasten/task_manager.rb in fasten-0.8.8 vs lib/fasten/task_manager.rb in fasten-0.10.0
- old
+ new
@@ -147,12 +147,13 @@
def move_pending_to_waiting
to_move = pending.select { |task| task.depends.count.zero? }
@pending -= to_move
@waiting += to_move
- @waiting.sort_by!.with_index do |x, index|
- x.state = :WAIT
- [-x.run_score, index]
+ @waiting.sort_by!.with_index do |task, index|
+ task.state = :WAIT
+ last_avg = task.last && task.last['avg'] || 0
+ [-task.run_score, -last_avg.to_f, index]
end
end
end
end