Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add await_many and related functions #76

Open
joakin opened this issue Sep 24, 2024 · 1 comment
Open

Add await_many and related functions #76

joakin opened this issue Sep 24, 2024 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@joakin
Copy link

joakin commented Sep 24, 2024

For running many tasks in parallel, it is complicated to get a solid solution, for example:

pub fn parallel(make_tasks: List(fn() -> a), timeout: Int) -> List(a) {
  make_tasks
  |> list.map(fn(make_task) { task.async(make_task) })
  |> list.map(fn(t) { task.await(t, timeout) })
}

Works but the timeouts will be run in sequence which is not what you really want.

It has been mentioned in discord a few times too:

@lpil lpil added the help wanted Extra attention is needed label Sep 24, 2024
@lpil
Copy link
Member

lpil commented Oct 31, 2024

Some of these functions have been added in v0.13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants