Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/aerospike/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def put_connection(conn)
def tend_connection
if @tend_connection.nil? || @tend_connection.closed?
@tend_connection = Cluster::CreateConnection.(cluster, host)
@tend_connection.timeout = cluster.connection_timeout
end
@tend_connection
end
Expand Down
4 changes: 3 additions & 1 deletion lib/aerospike/node_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
module Aerospike
class NodeValidator # :nodoc:

attr_reader :host, :aliases, :name, :features, :cluster_name, :tls_options, :conn
attr_reader :host, :timeout, :aliases, :name, :features, :cluster_name, :tls_options, :conn

def initialize(cluster, host, timeout, cluster_name, tls_options = {})
@cluster = cluster
@features = Set.new
@host = host
@timeout = timeout
@cluster_name = cluster_name
@tls_options = tls_options

Expand All @@ -44,6 +45,7 @@ def get_hosts(address)

begin
conn = Cluster::CreateConnection.(@cluster, Host.new(address, host.port, host.tls_name))
conn.timeout = timeout

commands = %w[node features]
commands << address_command unless is_loopback?(address)
Expand Down
4 changes: 4 additions & 0 deletions spec/aerospike/node_validator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
before do
allow(socket).to receive(:write).and_return(nil)
allow(socket).to receive(:read).and_return(nil)
allow(socket).to receive(:timeout=).and_return(nil)
expect(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
end

Expand All @@ -31,6 +32,7 @@
let(:hosts) { [::Aerospike::Host.new('192.168.1.1', '3000')] }

before do
allow(socket).to receive(:timeout=).and_return(nil)
allow(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)

expect(::Aerospike::Info).to receive(:request).and_return(
Expand All @@ -49,6 +51,7 @@
let(:hosts) { [::Aerospike::Host.new('my.lb.com', '3000')] }

before do
allow(socket).to receive(:timeout=).and_return(nil)
allow(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
expect(Resolv).to receive(:getaddresses).and_return(['101.1.1.1', '102.1.1.1'])

Expand Down Expand Up @@ -79,6 +82,7 @@
let(:policy) { ::Aerospike::ClientPolicy.new(tls: { enable: true }) }

before do
allow(socket).to receive(:timeout=).and_return(nil)
allow(::Aerospike::Cluster::CreateConnection).to receive(:call).and_return(socket)
expect(Resolv).to receive(:getaddresses).and_return(['101.1.1.1', '102.1.1.1'])

Expand Down