Skip to content

Commit

Permalink
fix: check if monitor pid exists before stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
zookzook committed Feb 5, 2023
1 parent 953b8c2 commit 6e0c8b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/mongo/topology.ex
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,11 @@ defmodule Mongo.Topology do

defp remove_address(address, state) do
Mongo.Events.notify(%ServerClosedEvent{address: address, topology_pid: self()})
GenServer.stop(state.monitors[address])

case state.monitors[address] do
nil -> :ok
pid -> GenServer.stop(pid)
end

case state.connection_pools[address] do
nil -> :ok
Expand Down

0 comments on commit 6e0c8b2

Please sign in to comment.