Skip to content

Instantly share code, notes, and snippets.

@thechrisoshow
Created September 17, 2009 14:01
Show Gist options
  • Save thechrisoshow/188503 to your computer and use it in GitHub Desktop.
Save thechrisoshow/188503 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)
remove_task_from_workers_events(worker, task)
worker.bucket.clear_warnings!
else
return true
end
end
end
@tasks_past_deadline << task
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment