11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/event_store/http/connect/leader.rb', line 11
def connect(net_http=nil)
net_http ||= super()
member_info = Info.(connection: net_http)
return net_http if member_info.leader?
cluster_status = Gossip.(connection: net_http)
if cluster_status.leader.nil?
error_message = "Leader is unavailable (Host: #{host}, Port: #{port})"
logger.error { error_message }
raise LeaderUnavailableError, error_message
end
leader_ip_address = cluster_status.leader.external_http_ip
raw leader_ip_address
end
|