Hey, this might be kind of a noob question - but I always was under the assumption that the process which is awaited by Task.await would die as soon as the timeout is reached. Given the following code:
defmodule Greeter do def run do task = Task.async(&greeter/0) Task.await(task, 10_000) IO.puts("work is done") end defp greeter do Process.sleep(1000) IO.puts("Hello") greeter() end end
If I run this in iex I would expect it to stop printing “Hello” to the shell after 10 seconds timed out. Instead I’m getting the error that the timeout has been reached but the greeter would still print “Hello” every second to the console. What am I missing here?