PS: Sorry - just noticed you’re discussing repeating timers
To avoid duplication I lean towards a simple
self() ! short_interval % Erlang
self() ! long_interval
.
Kernel.send self(), :short_interval # Elixir
Kernel.send self(), :long_interval
in init/1
to get things started and therefore leaving the timer specific code in the handle_info/2
function clauses.
The functions for managing one-off timers in Elixir are Process.send_after/4
and Process.cancel_timer/1
- just today I posted some sample code that uses them here.