Fix: genserver code
This commit is contained in:
parent
fa05cd3b91
commit
2c4a666c64
1 changed files with 3 additions and 3 deletions
|
@ -15,14 +15,14 @@ defmodule Jobs do
|
||||||
{:ok, init, {:continue, :work}}
|
{:ok, init, {:continue, :work}}
|
||||||
end
|
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
|
def handle_continue(:work, state) do
|
||||||
{:noreply, work_then_reschedule(state)}
|
{:noreply, work_then_reschedule(state)}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Exec the job when :work message is received
|
# Handle info and pass it to continue
|
||||||
def handle_info(:work, state) do
|
def handle_info(:work, state) do
|
||||||
{:noreply, work_then_reschedule(state)}
|
{:noreply, state, {:continue, :work}}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Get timer from config.exs
|
# Get timer from config.exs
|
||||||
|
|
Loading…
Reference in a new issue