Skip to content

Instantly share code, notes, and snippets.

@michaeljbishop
Created February 21, 2013 21:45
Show Gist options
  • Save michaeljbishop/5008562 to your computer and use it in GitHub Desktop.
Save michaeljbishop/5008562 to your computer and use it in GitHub Desktop.
Another fix for the duplicate task-arguments problem.
# Invoke all the prerequisites of a task in parallel.
def invoke_prerequisites_concurrently(task_args, invocation_chain) # :nodoc:
futures = prerequisite_tasks.collect do |p|
prereq_args = task_args.new_scope(p.arg_names)
# application.thread_pool.future(p) do |r|
# r.invoke_with_call_chain(prereq_args, invocation_chain)
# end
application.thread_pool.future do
p.invoke_with_call_chain(prereq_args, invocation_chain)
end
end
futures.each { |f| f.value }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment