Skip to content

Commit de93db9

Browse files
committed
WIP set serverSelector correctly
1 parent ad5690b commit de93db9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/sdam/topology.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
257257

258258
/**
259259
* @param seedlist - a list of HostAddress instances to connect to
260+
* TODO(NODE-5682): don't pass in entire MongoOptions object
260261
*/
261262
constructor(client: MongoClient, options: MongoOptions) {
262263
super();
@@ -293,9 +294,8 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
293294
this.component = 'topology';
294295

295296
if (options.srvHost && !options.loadBalanced) {
296-
this.s.srvPoller =
297-
// @ts-expect-error: todo
298-
options.srvPoller ??
297+
// @ts-expect-error: todo
298+
options.srvPoller ??
299299
new SrvPoller({
300300
heartbeatFrequencyMS: this.s.heartbeatFrequencyMS,
301301
srvHost: options.srvHost,
@@ -510,7 +510,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
510510
* @returns An instance of a `Server` meeting the criteria of the predicate provided
511511
*/
512512
async selectServer(
513-
selector: string | ReadPreference | ServerSelector,
513+
selector: string | ReadPreference | ServerSelector | undefined,
514514
options: SelectServerOptions
515515
): Promise<Server> {
516516
const shouldInitialize = this.s.state === STATE_UNITIALIZED;
@@ -576,7 +576,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
576576
) {
577577
this.client.mongoLogger?.debug(
578578
MongoLoggableComponent.SERVER_SELECTION,
579-
new ServerSelectionStartedEvent(selector, this.description, options.operationName)
579+
new ServerSelectionStartedEvent(serverSelector, this.description, options.operationName)
580580
);
581581
}
582582
let timeout;
@@ -599,7 +599,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
599599
this.client.mongoLogger?.debug(
600600
MongoLoggableComponent.SERVER_SELECTION,
601601
new ServerSelectionSucceededEvent(
602-
selector,
602+
serverSelector,
603603
this.description,
604604
transaction.server.pool.address,
605605
options.operationName
@@ -662,7 +662,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
662662
this.client.mongoLogger?.debug(
663663
MongoLoggableComponent.SERVER_SELECTION,
664664
new ServerSelectionFailedEvent(
665-
selector,
665+
serverSelector,
666666
this.description,
667667
timeoutError,
668668
options.operationName

0 commit comments

Comments
 (0)