lib/topologies/replset.js
function executeReconnect(self) {
    return function() {
      if (self.state === DESTROYED || self.state === UNREFERENCED) {
        return;
      }

      connectNewServers(self, self.s.replicaSetState.unknownServers, function() {
        var monitoringFrequencey = self.s.replicaSetState.hasPrimary()
          ? _haInterval
          : self.s.minHeartbeatFrequencyMS;

        // Create a timeout
        self.intervalIds.push(new Timeout(executeReconnect(self), monitoringFrequencey).start());
      });
    };
  }
function executeReconnect(self) {
    return function() {
      if (self.state === DESTROYED || self.state === UNREFERENCED) {
        return;
      }

      connectNewServers(self, self.s.replicaSetState.unknownServers, function() {
        var monitoringFrequencey = self.s.replicaSetState.hasPrimary()
          ? _haInterval
          : self.s.minHeartbeatFrequencyMS;

        // Create a timeout
        self.intervalIds.push(new Timeout(executeReconnect(self), monitoringFrequencey).start());
      });
    };
  }
function executeReconnect ( self ) { return function ( ) { if ( self . state === DESTROYED || self . state === UNREFERENCED ) { return ; } connectNewServers ( self , self . s . replicaSetState . unknownServers , function ( ) { var monitoringFrequencey = self . s . replicaSetState . hasPrimary ( ) ? _haInterval : self . s . minHeartbeatFrequencyMS ; // Create a timeout self . intervalIds . push ( new Timeout ( executeReconnect ( self ) , monitoringFrequencey ) . start ( ) ) ; } ) ; } ; }
Run the reconnect process
Run the reconnect process