recycle v0.1.2 Recycle behaviour
Convienience wrapper around :gen_cycle
behaviour for periodic, supervised
task execution.
Interval is expressed in milliseconds.
Usage:
defmodule EveryMinute do
use Recycle, interval: :timer.seconds(60)
@impl true
def init_user_state(_opts) do
%{work: fn -> do_work() end}
end
@impl true
def handle_user_cycle(%{work: fun} = state) do
fun.()
{:hibernate, state}
end
end
Link to this section Summary
Link to this section Callbacks
Link to this callback
handle_user_cycle(any)
Link to this callback