You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
567 B
20 lines
567 B
defmodule TirInnaNoc.Merlin do
|
|
use GenServer
|
|
|
|
def start_link(a) do
|
|
GenServer.start_link(__MODULE__, a)
|
|
end
|
|
|
|
@impl true
|
|
def init(a) do
|
|
{:ok, relevant} = TirInnaNoc.Db.smembers("boards")
|
|
relevant
|
|
|> Enum.each(fn board ->
|
|
DynamicSupervisor.start_child(
|
|
MerlinSupervisor, {DynamicSupervisor, strategy: :one_for_one, name: String.to_atom(board<>"Supervisor")}
|
|
)
|
|
DynamicSupervisor.start_child(MerlinSupervisor, {TirInnaNoc.Meldh, %TirInnaNoc.Imageboard.Board{board: board, threads: %{}}})
|
|
end)
|
|
{:ok, a}
|
|
end
|
|
end
|
|
|