Skip to content

chore(NODE-6498): remove dead code in Topology #4310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ export type {
ReadPreferenceOptions
} from './read_preference';
export type { AsyncDisposable } from './resource_management';
export type { ClusterTime, TimerQueue } from './sdam/common';
export type { ClusterTime } from './sdam/common';
export type {
Monitor,
MonitorEvents,
Expand Down
11 changes: 0 additions & 11 deletions src/sdam/common.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { clearTimeout } from 'timers';

import type { Binary, Long, Timestamp } from '../bson';
import type { ClientSession } from '../sessions';
import type { Topology } from './topology';
Expand Down Expand Up @@ -46,15 +44,6 @@ export const ServerType = Object.freeze({
/** @public */
export type ServerType = (typeof ServerType)[keyof typeof ServerType];

/** @internal */
export type TimerQueue = Set<NodeJS.Timeout>;

/** @internal */
export function drainTimerQueue(queue: TimerQueue): void {
queue.forEach(clearTimeout);
queue.clear();
}

/**
* @public
* Gossiped in component for the cluster time tracking the state of user databases
Expand Down
9 changes: 0 additions & 9 deletions src/sdam/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ import {
import {
_advanceClusterTime,
type ClusterTime,
drainTimerQueue,
ServerType,
STATE_CLOSED,
STATE_CLOSING,
STATE_CONNECTED,
STATE_CONNECTING,
type TimerQueue,
TopologyType
} from './common';
import {
Expand Down Expand Up @@ -132,8 +130,6 @@ export interface TopologyPrivate {
servers: Map<string, Server>;
credentials?: MongoCredentials;
clusterTime?: ClusterTime;
/** timers created for the initial connect to a server */
connectionTimers: TimerQueue;

/** related to srv polling */
srvPoller?: SrvPoller;
Expand Down Expand Up @@ -325,8 +321,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
credentials: options?.credentials,
clusterTime: undefined,

// timer management
connectionTimers: new Set<NodeJS.Timeout>(),
detectShardedTopology: ev => this.detectShardedTopology(ev),
detectSrvRecords: ev => this.detectSrvRecords(ev)
};
Expand Down Expand Up @@ -415,8 +409,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
} finally {
this.connectionLock = undefined;
}

return this;
}

private async _connect(options?: ConnectOptions): Promise<Topology> {
Expand Down Expand Up @@ -515,7 +507,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
stateTransition(this, STATE_CLOSING);

drainWaitQueue(this[kWaitQueue], new MongoTopologyClosedError());
drainTimerQueue(this.s.connectionTimers);

if (this.s.srvPoller) {
this.s.srvPoller.stop();
Expand Down