-
-
Save khionu/7da26e1c53108ee4b462ef570f19b61b to your computer and use it in GitHub Desktop.
reply_after
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_call(msg, from, state) do | |
delay = delay_calc(state) | |
GenServer.reply_after(from, :go, delay) | |
{:no_reply, state} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def handle_call(msg, from, state) do | |
delay = delay_calc(state) | |
Task.start(fn -> | |
sleep(delay) | |
GenServer.reply(from, :go) | |
end) | |
{:no_reply, state} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment