Skip to content

Instantly share code, notes, and snippets.

@dinocosta
Created February 6, 2019 12:01
Show Gist options
  • Select an option

  • Save dinocosta/090d39fb03014d26eee5ae8d49dde45a to your computer and use it in GitHub Desktop.

Select an option

Save dinocosta/090d39fb03014d26eee5ae8d49dde45a to your computer and use it in GitHub Desktop.
defmodule Processor do
def process(number) do
:timer.sleep(1000)
{number, :os.system_time(:millisecond)}
end
end
1..10
|> Task.async_stream(&Processor.process/1, max_concurrency: 2)
|> Enum.to_list()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment