elixir - How to get keys (pids) of registered via Register children -


i want use registry module register dynamically created children processes. added registry supervisor tree:

def init([])   children = [     supervisor(registry, [:unique, :my_registry]),     supervisor(mymanager, []),     # ...   ]   opts = [strategy: :one_for_one, name: mysupervisor]   supervise(children, opts) end 

registration of children happens this:

def start_link(%{id: id})   genserver.start_link(__module__, [], name: {:via, registry, {:my_registry, id}}) end 

so, questions – how keys (children pids) in registry. tried use registry.keys\2, without success.

def get_registry_pid   supervisor.which_children(mysupervisor)   |> enum.filter(fn {id, _, _, _} -> id == registry end)   |> list.first   |> elem(1) # regisry pid tuple {id, pid, type, modules} end registry.keys(:my_registry, get_registry_pid()) # returns [] #  registry.lookup(:my_registry, id) # returns pid expected 

thanks in advance help!


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -