Fix error starting application
This commit is contained in:
		
							parent
							
								
									9cbb59fca3
								
							
						
					
					
						commit
						13e58e406b
					
				@ -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
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
@ -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})
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user