From 8373cccfdb2418e6bb78afe04fd35e003328a4de Mon Sep 17 00:00:00 2001 From: Bailey Pearson Date: Sat, 2 Nov 2024 15:50:58 -0600 Subject: [PATCH] remove dead code --- src/index.ts | 2 +- src/sdam/common.ts | 11 ----------- src/sdam/topology.ts | 9 --------- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/index.ts b/src/index.ts index 39d4df719de..73f0d52e16e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -553,7 +553,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, diff --git a/src/sdam/common.ts b/src/sdam/common.ts index fab8124d4c6..97411485676 100644 --- a/src/sdam/common.ts +++ b/src/sdam/common.ts @@ -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'; @@ -46,15 +44,6 @@ export const ServerType = Object.freeze({ /** @public */ export type ServerType = (typeof ServerType)[keyof typeof ServerType]; -/** @internal */ -export type TimerQueue = Set; - -/** @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 diff --git a/src/sdam/topology.ts b/src/sdam/topology.ts index 73b0e92a09a..34bda3b58c6 100644 --- a/src/sdam/topology.ts +++ b/src/sdam/topology.ts @@ -49,13 +49,11 @@ import { import { _advanceClusterTime, type ClusterTime, - drainTimerQueue, ServerType, STATE_CLOSED, STATE_CLOSING, STATE_CONNECTED, STATE_CONNECTING, - type TimerQueue, TopologyType } from './common'; import { @@ -132,8 +130,6 @@ export interface TopologyPrivate { servers: Map; credentials?: MongoCredentials; clusterTime?: ClusterTime; - /** timers created for the initial connect to a server */ - connectionTimers: TimerQueue; /** related to srv polling */ srvPoller?: SrvPoller; @@ -322,8 +318,6 @@ export class Topology extends TypedEventEmitter { credentials: options?.credentials, clusterTime: undefined, - // timer management - connectionTimers: new Set(), detectShardedTopology: ev => this.detectShardedTopology(ev), detectSrvRecords: ev => this.detectSrvRecords(ev) }; @@ -412,8 +406,6 @@ export class Topology extends TypedEventEmitter { } finally { this.connectionLock = undefined; } - - return this; } private async _connect(options?: ConnectOptions): Promise { @@ -501,7 +493,6 @@ export class Topology extends TypedEventEmitter { stateTransition(this, STATE_CLOSING); drainWaitQueue(this[kWaitQueue], new MongoTopologyClosedError()); - drainTimerQueue(this.s.connectionTimers); if (this.s.srvPoller) { this.s.srvPoller.stop();