Skip to content

Commit d451a9a

Browse files
committed
@host and @PORT are available in the Broker
No need for connection.to_s
1 parent a50454a commit d451a9a

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

lib/kafka/broker.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def address_match?(host, port)
1919

2020
# @return [String]
2121
def to_s
22-
"#{connection_to_s} (node_id=#{@node_id.inspect})"
22+
"#{@host}:#{@port} (node_id=#{@node_id.inspect})"
2323
end
2424

2525
# @return [nil]
@@ -163,9 +163,5 @@ def send_request(request)
163163
def connection
164164
@connection ||= @connection_builder.build_connection(@host, @port)
165165
end
166-
167-
def connection_to_s
168-
connection.to_s rescue nil
169-
end
170166
end
171167
end

spec/broker_spec.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,4 @@ def close
132132
broker.disconnect
133133
end
134134
end
135-
136-
describe "#to_s" do
137-
it "doesn't fail when building connection fails" do
138-
expect(connection_builder).to receive(:build_connection).and_raise(Kafka::ConnectionError)
139-
140-
expect do
141-
broker.to_s
142-
end.not_to raise_error
143-
end
144-
end
145135
end

0 commit comments

Comments
 (0)