Hello,
Actually I’m having problem to unregister in Registry supervisor, when a user connects and send a especific message it check if the user if auth, if not create a GenServer than generate a name using Registry, but when the socket disconnect it unregister this name:
fn(pid) ->
account_login = AuthClient.get_account(pid) # Check for the name
Registry.unregister(:accounts_registry, account_login) # Unregister the name, and exit the genserver (?)
IO.inspect(account_login)
IO.inspect(Registry.lookup(:accounts_registry, account_login)) #Show the actual names running
end
But the result is this:
iex(1)> "test" # account_login
iex(1)> [{#PID<0.254.0>, nil}] # lookup, as show it dont unregister
Someone knows how I can fix this problem?
Greetings!
EDIT: When I terminate the GenServer directly ranch gives me this exception:
Ranch listener :MyApp had connection process started with MyApp.Sync.Handler:start_link/4 at #PID<0.251.0> exit with reason: {:normal, {GenServer, :call, [{:via, Registry, {:accounts_registry, "test"}}, :terminate, 5000]}}