Caveat: Compatibility with OTP behaviours
It is not recommended to await a long-running task inside an OTP behaviour such as GenServer. Instead, you should match on the message coming from a task inside your GenServer.handle_info/2 callback.
GenServer.handle_info/2
If you need to go that route have a look at: