Current section
Files
Jump to
Current section
Files
lib/backends/memory/supervisors/endpoint_supervisor.ex
defmodule Pollin.Backend.Memory.EndpointSupervisor do
@moduledoc false
use Supervisor
alias Pollin.Backend.Memory.{CallbackWorker, EndpointWorker}
@doc false
def start_link,
do: Supervisor.start_link(__MODULE__, [], name: __MODULE__)
@doc false
def init([]) do
children = [worker(EndpointWorker, [], id: make_ref)]
opts = [strategy: :one_for_one, name: __MODULE__]
supervise(children, opts)
end
@doc false
def start_callback_worker(id) do
import Supervisor.Spec, warn: false
Supervisor.start_child(
__MODULE__, worker(CallbackWorker, [id], id: id))
end
end