Skip to content

Commit 03295c6

Browse files
committed
RUBY-2691 Update concurrently added code to use service_id delegation from connection
1 parent f682231 commit 03295c6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/mongo/server/connection_base.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ class ConnectionBase < ConnectionCommon
8989
:mongos?
9090

9191
# @return [ nil | Object ] The service id, if any.
92-
def_delegators :description, :service_id
92+
def service_id
93+
description&.service_id
94+
end
9395

9496
# Connection pool generation from which this connection was created.
9597
# May be nil.

lib/mongo/server/connection_common.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,15 @@ def add_server_diagnostics
128128
if respond_to?(:id)
129129
note << ", connection #{generation}:#{id}"
130130
end
131-
if respond_to?(:description) && description&.service_id
132-
note << ", service id #{description.service_id}"
131+
if service_id
132+
note << ", service id #{service_id}"
133133
end
134134
e.add_note(note)
135135
if respond_to?(:generation)
136136
# Non-monitoring connections
137137
e.generation = generation
138138
if respond_to?(:description)
139-
e.service_id = description&.service_id
139+
e.service_id = service_id
140140
end
141141
end
142142
raise e

0 commit comments

Comments
 (0)