@@ -8,8 +8,6 @@ const MongoTimeoutError = require('../error').MongoTimeoutError;
8
8
9
9
const common = require ( './common' ) ;
10
10
const STATE_CLOSED = common . STATE_CLOSED ;
11
- const TOPOLOGY_DEFAULTS = common . TOPOLOGY_DEFAULTS ;
12
- const drainTimerQueue = common . drainTimerQueue ;
13
11
const clearAndRemoveTimerFrom = common . clearAndRemoveTimerFrom ;
14
12
15
13
// max staleness constants
@@ -183,7 +181,8 @@ function readPreferenceServerSelector(readPreference) {
183
181
const commonWireVersion = topologyDescription . commonWireVersion ;
184
182
if (
185
183
commonWireVersion &&
186
- ( readPreference . minWireVersion && readPreference . minWireVersion > commonWireVersion )
184
+ readPreference . minWireVersion &&
185
+ readPreference . minWireVersion > commonWireVersion
187
186
) {
188
187
throw new MongoError (
189
188
`Minimum wire version '${
@@ -298,18 +297,10 @@ function selectServers(topology, selector, timeout, start, callback) {
298
297
}
299
298
300
299
const retrySelection = ( ) => {
301
- // clear all existing monitor timers
302
- drainTimerQueue ( topology . s . monitorTimers ) ;
303
-
304
300
// ensure all server monitors attempt monitoring soon
305
- topology . s . servers . forEach ( server => {
306
- const timer = setTimeout (
307
- ( ) => server . monitor ( { heartbeatFrequencyMS : topology . description . heartbeatFrequencyMS } ) ,
308
- TOPOLOGY_DEFAULTS . minHeartbeatFrequencyMS
309
- ) ;
310
-
311
- topology . s . monitorTimers . add ( timer ) ;
312
- } ) ;
301
+ topology . s . servers . forEach ( server =>
302
+ server . monitor ( { heartbeatFrequencyMS : topology . description . heartbeatFrequencyMS } )
303
+ ) ;
313
304
314
305
const iterationTimer = setTimeout ( ( ) => {
315
306
topology . removeListener ( 'topologyDescriptionChanged' , descriptionChangedHandler ) ;
0 commit comments