Fix error starting application

This commit is contained in:
Mike Cifelli 2024-03-27 13:58:48 -04:00
parent 9cbb59fca3
commit 13e58e406b
Signed by: mike
GPG Key ID: 6B08C6BE47D08E4C
2 changed files with 4 additions and 4 deletions

View File

@ -17,7 +17,6 @@ defmodule Chronoscope.Application do
# {Chronoscope.Worker, arg},
{DynamicSupervisor, name: Chronoscope.DynamicSupervisor, strategy: :one_for_one},
{Task.Supervisor, name: Chronoscope.TaskSupervisor},
Chronoscope.NTS.Client,
# Start to serve requests, typically the last entry
ChronoscopeWeb.Endpoint
]

View File

@ -14,13 +14,14 @@ defmodule Chronoscope.NTS do
end
def list() do
DynamicSupervisor.count_children(Chronoscope.DynamicSupervisor)
|> IO.inspect()
Chronoscope.DynamicSupervisor
|> DynamicSupervisor.which_children()
|> Enum.map(fn {_, pid, _, _} -> GenServer.call(pid, :list) end)
end
def key_establishment(host, port) do
# 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
DynamicSupervisor.start_child(Chronoscope.DynamicSupervisor, {NTS.Client, name: name})