Skip to content

Commit fd7acde

Browse files
chore(NODE-6498): remove dead code in Topology (#4310)
1 parent 6c02964 commit fd7acde

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ export type {
561561
ReadPreferenceOptions
562562
} from './read_preference';
563563
export type { AsyncDisposable } from './resource_management';
564-
export type { ClusterTime, TimerQueue } from './sdam/common';
564+
export type { ClusterTime } from './sdam/common';
565565
export type {
566566
Monitor,
567567
MonitorEvents,

src/sdam/common.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { clearTimeout } from 'timers';
2-
31
import type { Binary, Long, Timestamp } from '../bson';
42
import type { ClientSession } from '../sessions';
53
import type { Topology } from './topology';
@@ -46,15 +44,6 @@ export const ServerType = Object.freeze({
4644
/** @public */
4745
export type ServerType = (typeof ServerType)[keyof typeof ServerType];
4846

49-
/** @internal */
50-
export type TimerQueue = Set<NodeJS.Timeout>;
51-
52-
/** @internal */
53-
export function drainTimerQueue(queue: TimerQueue): void {
54-
queue.forEach(clearTimeout);
55-
queue.clear();
56-
}
57-
5847
/**
5948
* @public
6049
* Gossiped in component for the cluster time tracking the state of user databases

src/sdam/topology.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,11 @@ import {
5050
import {
5151
_advanceClusterTime,
5252
type ClusterTime,
53-
drainTimerQueue,
5453
ServerType,
5554
STATE_CLOSED,
5655
STATE_CLOSING,
5756
STATE_CONNECTED,
5857
STATE_CONNECTING,
59-
type TimerQueue,
6058
TopologyType
6159
} from './common';
6260
import {
@@ -132,8 +130,6 @@ export interface TopologyPrivate {
132130
servers: Map<string, Server>;
133131
credentials?: MongoCredentials;
134132
clusterTime?: ClusterTime;
135-
/** timers created for the initial connect to a server */
136-
connectionTimers: TimerQueue;
137133

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

328-
// timer management
329-
connectionTimers: new Set<NodeJS.Timeout>(),
330324
detectShardedTopology: ev => this.detectShardedTopology(ev),
331325
detectSrvRecords: ev => this.detectSrvRecords(ev)
332326
};
@@ -415,8 +409,6 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
415409
} finally {
416410
this.connectionLock = undefined;
417411
}
418-
419-
return this;
420412
}
421413

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

517509
drainWaitQueue(this[kWaitQueue], new MongoTopologyClosedError());
518-
drainTimerQueue(this.s.connectionTimers);
519510

520511
if (this.s.srvPoller) {
521512
this.s.srvPoller.stop();

0 commit comments

Comments
 (0)