Skip to content

Instantly share code, notes, and snippets.

@thechrisoshow
Created September 17, 2009 14:04
Show Gist options
  • Save thechrisoshow/188505 to your computer and use it in GitHub Desktop.
Save thechrisoshow/188505 to your computer and use it in GitHub Desktop.
def schedule_task_to_next_available_worker(task)
@workers.each do |worker|
task_scheduler = TaskScheduler.new(worker.bucket)
if task_scheduler.task_valid_for_putting_into_buckets?(task)
task_scheduler.schedule_task(task)
if !worker.bucket.has_warning?(:overdue)
if !any_workers_after_this_one_have_hat(task.hat)
@tasks_past_deadline << task
return true
else
unschedule_this_task
end
else
return true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment