Fix error starting application
This commit is contained in:
parent
9cbb59fca3
commit
13e58e406b
|
@ -17,7 +17,6 @@ defmodule Chronoscope.Application do
|
||||||
# {Chronoscope.Worker, arg},
|
# {Chronoscope.Worker, arg},
|
||||||
{DynamicSupervisor, name: Chronoscope.DynamicSupervisor, strategy: :one_for_one},
|
{DynamicSupervisor, name: Chronoscope.DynamicSupervisor, strategy: :one_for_one},
|
||||||
{Task.Supervisor, name: Chronoscope.TaskSupervisor},
|
{Task.Supervisor, name: Chronoscope.TaskSupervisor},
|
||||||
Chronoscope.NTS.Client,
|
|
||||||
# Start to serve requests, typically the last entry
|
# Start to serve requests, typically the last entry
|
||||||
ChronoscopeWeb.Endpoint
|
ChronoscopeWeb.Endpoint
|
||||||
]
|
]
|
||||||
|
|
|
@ -14,13 +14,14 @@ defmodule Chronoscope.NTS do
|
||||||
end
|
end
|
||||||
|
|
||||||
def list() do
|
def list() do
|
||||||
DynamicSupervisor.count_children(Chronoscope.DynamicSupervisor)
|
Chronoscope.DynamicSupervisor
|
||||||
|> IO.inspect()
|
|> DynamicSupervisor.which_children()
|
||||||
|
|> Enum.map(fn {_, pid, _, _} -> GenServer.call(pid, :list) end)
|
||||||
end
|
end
|
||||||
|
|
||||||
def key_establishment(host, port) do
|
def key_establishment(host, port) do
|
||||||
# todo don't use atoms for this
|
# todo don't use atoms for this
|
||||||
name = String.to_atom("#{host}#{port}")
|
name = String.to_atom("#{host}:#{port}")
|
||||||
|
|
||||||
if GenServer.whereis(name) == nil do
|
if GenServer.whereis(name) == nil do
|
||||||
DynamicSupervisor.start_child(Chronoscope.DynamicSupervisor, {NTS.Client, name: name})
|
DynamicSupervisor.start_child(Chronoscope.DynamicSupervisor, {NTS.Client, name: name})
|
||||||
|
|
Loading…
Reference in New Issue