Task

await/2

await(task, timeout \\ 5000)

Blocks the caller until the given %Task{} finishes and returns its result.

If the task doesn’t complete within timeout milliseconds (default 5000), the calling process exits. Because of the link, the task process exits too.