Skip to content

Commit

Permalink
refactor(monitoring): hoist Server constants out of monitor code
Browse files Browse the repository at this point in the history
  • Loading branch information
mbroadst committed Oct 15, 2019
1 parent 8a4de3f commit ee15ea0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/core/sdam/monitoring.js
Expand Up @@ -3,6 +3,10 @@
const ServerDescription = require('./server_description').ServerDescription;
const calculateDurationInMs = require('../utils').calculateDurationInMs;

// pulled from `Server` implementation
const STATE_DISCONNECTED = 'disconnected';
const STATE_DISCONNECTING = 'disconnecting';

/**
* Published when server description changes, but does NOT include changes to the RTT.
*
Expand Down Expand Up @@ -176,9 +180,6 @@ function monitorServer(server, options) {

// emit an event indicating that our description has changed
server.emit('descriptionReceived', new ServerDescription(server.description.address, isMaster));

const STATE_DISCONNECTED = 'disconnected';
const STATE_DISCONNECTING = 'disconnecting';
if (server.s.state === STATE_DISCONNECTED || server.s.state === STATE_DISCONNECTING) {
return;
}
Expand Down

0 comments on commit ee15ea0

Please sign in to comment.