Skip to content

Commit

Permalink
WIP set serverSelector correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
W-A-James committed Jul 19, 2024
1 parent ad5690b commit de93db9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/sdam/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {

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

if (options.srvHost && !options.loadBalanced) {
this.s.srvPoller =
// @ts-expect-error: todo
options.srvPoller ??
// @ts-expect-error: todo
options.srvPoller ??
new SrvPoller({
heartbeatFrequencyMS: this.s.heartbeatFrequencyMS,
srvHost: options.srvHost,
Expand Down Expand Up @@ -510,7 +510,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
* @returns An instance of a `Server` meeting the criteria of the predicate provided
*/
async selectServer(
selector: string | ReadPreference | ServerSelector,
selector: string | ReadPreference | ServerSelector | undefined,
options: SelectServerOptions
): Promise<Server> {
const shouldInitialize = this.s.state === STATE_UNITIALIZED;
Expand Down Expand Up @@ -576,7 +576,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
) {
this.client.mongoLogger?.debug(
MongoLoggableComponent.SERVER_SELECTION,
new ServerSelectionStartedEvent(selector, this.description, options.operationName)
new ServerSelectionStartedEvent(serverSelector, this.description, options.operationName)
);
}
let timeout;
Expand All @@ -599,7 +599,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
this.client.mongoLogger?.debug(
MongoLoggableComponent.SERVER_SELECTION,
new ServerSelectionSucceededEvent(
selector,
serverSelector,
this.description,
transaction.server.pool.address,
options.operationName
Expand Down Expand Up @@ -662,7 +662,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
this.client.mongoLogger?.debug(
MongoLoggableComponent.SERVER_SELECTION,
new ServerSelectionFailedEvent(
selector,
serverSelector,
this.description,
timeoutError,
options.operationName
Expand Down

0 comments on commit de93db9

Please sign in to comment.