Fix: genserver code

This commit is contained in:
Wilfried OLLIVIER 2020-08-10 09:15:46 +02:00
parent fa05cd3b91
commit 2c4a666c64
1 changed files with 3 additions and 3 deletions

View File

@ -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