diff --git a/src/index.ts b/src/index.ts index dd4d8a21d95..03423532dbb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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, 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 2ea7d3244f1..fcfc05d06ad 100644 --- a/src/sdam/topology.ts +++ b/src/sdam/topology.ts @@ -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 { @@ -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; @@ -325,8 +321,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) }; @@ -415,8 +409,6 @@ export class Topology extends TypedEventEmitter { } finally { this.connectionLock = undefined; } - - return this; } private async _connect(options?: ConnectOptions): Promise { @@ -515,7 +507,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();