Skip to content

Commit

Permalink
Make sure to stop disconnected pool
Browse files Browse the repository at this point in the history
  • Loading branch information
harunzengin committed Dec 9, 2024
1 parent a705af1 commit 579ea7d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/xandra/cluster/pool.ex
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ defmodule Xandra.Cluster.Pool do
when is_peername(peername) do
# Not connected anymore, but we're not really sure if the whole host is down.
data = set_host_status(data, peername, :up)
data = stop_pool(data, data.peers[peername].host)
data = maybe_start_pools(data)
{:keep_state, data}
end

Expand Down Expand Up @@ -502,11 +504,14 @@ defmodule Xandra.Cluster.Pool do
lb_callback =
case new_status do
:up -> :host_up
:down -> :host_down
:down -> :host_down
:connected -> :host_connected
end

update_in(data.load_balancing_state, &apply(data.load_balancing_module, lb_callback, [&1, host]))
update_in(
data.load_balancing_state,
&apply(data.load_balancing_module, lb_callback, [&1, host])
)
end

defp stop_pool(data, %Host{} = host) do
Expand Down

0 comments on commit 579ea7d

Please sign in to comment.