diff --git a/src/dev/elixir/genserver.md b/src/dev/elixir/genserver.md index 1f33074..d1b64a6 100644 --- a/src/dev/elixir/genserver.md +++ b/src/dev/elixir/genserver.md @@ -15,14 +15,14 @@ defmodule Jobs do {:ok, init, {:continue, :work}} end - # Exec the job for the first time, at the end of init + # Exec job on continue, then reschedule def handle_continue(:work, state) do {:noreply, work_then_reschedule(state)} end - # Exec the job when :work message is received + # Handle info and pass it to continue def handle_info(:work, state) do - {:noreply, work_then_reschedule(state)} + {:noreply, state, {:continue, :work}} end # Get timer from config.exs