Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 5 additions & 1 deletion lib/mongo/srv/monitor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ def do_work
def scan!
begin
last_result = Timeout.timeout(timeout) do
@resolver.get_records(@srv_uri.query_hostname)
@resolver.get_records(
@srv_uri.query_hostname,
@srv_uri.uri_options[:srv_service_name] || options[:srv_service_name],
@srv_uri.uri_options[:srv_max_hosts] || @options[:srv_max_hosts]
)
end
rescue Resolv::ResolvTimeout => e
log_warn("SRV monitor: timed out trying to resolve hostname #{@srv_uri.query_hostname}: #{e.class}: #{e}")
Expand Down
10 changes: 8 additions & 2 deletions lib/mongo/uri/srv_protocol.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ def raise_invalid_error!(details)
end

# Gets the SRV resolver.
# If domain verification fails or no SRV records are found,
# an error must not be raised per the spec; instead, a warning is logged.
#
# @return [ Mongo::Srv::Resolver ]
def resolver
@resolver ||= Srv::Resolver.new(
raise_on_invalid: true,
raise_on_invalid: false,
resolv_options: options[:resolv_options],
timeout: options[:connect_timeout],
)
Expand All @@ -149,7 +151,11 @@ def parse!(remaining)

log_debug "attempting to resolve #{hostname}"

@srv_result = resolver.get_records(hostname, uri_options[:srv_service_name], uri_options[:srv_max_hosts])
@srv_result = resolver.get_records(
hostname,
uri_options[:srv_service_name] || options[:srv_service_name],
Copy link

Copilot AI Jan 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed trailing whitespace from lines 155 and 156.

Suggested change
hostname,
uri_options[:srv_service_name] || options[:srv_service_name],
hostname,
uri_options[:srv_service_name] || options[:srv_service_name],

Copilot uses AI. Check for mistakes.
uri_options[:srv_max_hosts] || options[:srv_max_hosts]
)
if srv_result.empty?
raise Error::NoSRVRecords.new(NO_SRV_RECORDS % hostname)
end
Expand Down
Loading
Loading