Comment

Comment by neillyons

Elixir concurrency feels like magic with async_stream https://elixir.hexdocs.pm/Task.html#async_stream/5-options

  [
    "https://httpbin.org/delay/1",
    "https://httpbin.org/delay/2",
    "https://httpbin.org/delay/3"
  ]
  |> Task.async_stream(
    &Req.get!/1,
    max_concurrency: 3,
    ordered: true,
    timeout: to_timeout(second: 2)
  )
  |> Enum.to_list()
parent neillyons 1 month ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton