File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
packages/mongodb-build-info/src Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ export function getGenuineMongoDB(uri: string): {
146146type IdentifyServerNameOptions = {
147147 connectionString : string ;
148148 adminCommand : ( command : Document ) => Promise < Document > ;
149+ /** Pass this to prevent multiple requests for the same data */
150+ buildInfo ?: Promise < Document > ;
149151} ;
150152
151153/**
@@ -155,6 +157,7 @@ type IdentifyServerNameOptions = {
155157export async function identifyServerName ( {
156158 connectionString,
157159 adminCommand,
160+ buildInfo,
158161} : IdentifyServerNameOptions ) : Promise < string > {
159162 try {
160163 const hostname = getHostnameFromUrl ( connectionString ) ;
@@ -175,7 +178,7 @@ export async function identifyServerName({
175178 }
176179
177180 const candidates = await Promise . all ( [
178- adminCommand ( { buildInfo : 1 } ) . then (
181+ ( buildInfo ?? adminCommand ( { buildInfo : 1 } ) ) . then (
179182 ( response ) => {
180183 if ( 'ferretdb' in response ) {
181184 return [ 'ferretdb' ] ;
You can’t perform that action at this time.
0 commit comments