Skip to content

RUBY-2691 Update concurrently added code to use service_id delegation from connection #2291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 2, 2021
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
4 changes: 3 additions & 1 deletion lib/mongo/server/connection_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ class ConnectionBase < ConnectionCommon
:mongos?

# @return [ nil | Object ] The service id, if any.
def_delegators :description, :service_id
def service_id
description&.service_id
end

# Connection pool generation from which this connection was created.
# May be nil.
Expand Down
8 changes: 5 additions & 3 deletions lib/mongo/server/connection_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,15 +128,17 @@ def add_server_diagnostics
if respond_to?(:id)
note << ", connection #{generation}:#{id}"
end
if respond_to?(:description) && description&.service_id
note << ", service id #{description.service_id}"
# Non-monitoring connections have service id.
# Monitoring connections do not.
if respond_to?(:service_id) && service_id
note << ", service id #{service_id}"
end
e.add_note(note)
if respond_to?(:generation)
# Non-monitoring connections
e.generation = generation
if respond_to?(:description)
e.service_id = description&.service_id
e.service_id = service_id
end
end
raise e
Expand Down