Skip to content

Commit

Permalink
Handle :disconnected messages from connections
Browse files Browse the repository at this point in the history
  • Loading branch information
whatyouhide committed Aug 17, 2023
1 parent 9f5422d commit ab2a867
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/xandra/cluster/pool.ex
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,20 @@ defmodule Xandra.Cluster.Pool do
{:next_state, :has_connected_once, data, actions}
end

# Sent by the connection itself.
def handle_event(
:info,
{:xandra, :disconnected, peername, _pid},
_state,
%__MODULE__{} = data
)
when is_peername(peername) do
# Not connected anymore, but we're not really sure if the whole host is down.
data = put_in(data.peers[peername].status, :up)
data = stop_pool(data, data.peers[peername].host)
{:keep_state, data}
end

# Sent by the connection itself.
def handle_event(
:info,
Expand Down

0 comments on commit ab2a867

Please sign in to comment.