Comparing version 6.4.0-dev.20240301.sha.f2b3484 to 6.4.0-dev.20240305.sha.eab8f23
@@ -39,4 +39,10 @@ "use strict"; | ||
} | ||
// Asynchronously start TXT resolution so that we do not have to wait until | ||
// the SRV record is resolved before starting a second DNS query. | ||
const lookupAddress = options.srvHost; | ||
const txtResolutionPromise = dns.promises.resolveTxt(lookupAddress); | ||
txtResolutionPromise.catch(() => { | ||
/* rejections will be handled later */ | ||
}); | ||
// Resolve the SRV record and use the result as the list of hosts to connect to. | ||
const lookupAddress = options.srvHost; | ||
const addresses = await dns.promises.resolveSrv(`_${options.srvServiceName}._tcp.${lookupAddress}`); | ||
@@ -53,6 +59,6 @@ if (addresses.length === 0) { | ||
validateLoadBalancedOptions(hostAddresses, options, true); | ||
// Resolve TXT record and add options from there if they exist. | ||
// Use the result of resolving the TXT record and add options from there if they exist. | ||
let record; | ||
try { | ||
record = await dns.promises.resolveTxt(lookupAddress); | ||
record = await txtResolutionPromise; | ||
} | ||
@@ -59,0 +65,0 @@ catch (error) { |
{ | ||
"name": "mongodb", | ||
"version": "6.4.0-dev.20240301.sha.f2b3484", | ||
"version": "6.4.0-dev.20240305.sha.eab8f23", | ||
"description": "The official MongoDB driver for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -71,4 +71,11 @@ import * as dns from 'dns'; | ||
// Asynchronously start TXT resolution so that we do not have to wait until | ||
// the SRV record is resolved before starting a second DNS query. | ||
const lookupAddress = options.srvHost; | ||
const txtResolutionPromise = dns.promises.resolveTxt(lookupAddress); | ||
txtResolutionPromise.catch(() => { | ||
/* rejections will be handled later */ | ||
}); | ||
// Resolve the SRV record and use the result as the list of hosts to connect to. | ||
const lookupAddress = options.srvHost; | ||
const addresses = await dns.promises.resolveSrv( | ||
@@ -92,6 +99,6 @@ `_${options.srvServiceName}._tcp.${lookupAddress}` | ||
// Resolve TXT record and add options from there if they exist. | ||
// Use the result of resolving the TXT record and add options from there if they exist. | ||
let record; | ||
try { | ||
record = await dns.promises.resolveTxt(lookupAddress); | ||
record = await txtResolutionPromise; | ||
} catch (error) { | ||
@@ -98,0 +105,0 @@ if (error.code !== 'ENODATA' && error.code !== 'ENOTFOUND') { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2931237
60461