Skip to content

Commit afb125f

Browse files
committed
fix(srv-poller): always provide a valid number for intervalMS
A typo in the getter for `intervalMS` caused polling to occur immediately because a value of `undefined` was returned. NODE-2375
1 parent 8da416f commit afb125f

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/core/sdam/srv_polling.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class SrvPoller extends EventEmitter {
5959
}
6060

6161
get intervalMS() {
62-
return this.haMode ? this.heartbeatFrequencyMS : this.rescanSrvIntervalMs;
62+
return this.haMode ? this.heartbeatFrequencyMS : this.rescanSrvIntervalMS;
6363
}
6464

6565
start() {

test/unit/sdam/srv_polling.test.js

+7
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ describe('Mongos SRV Polling', function() {
6969
context.sinon.stub(poller, 'parentDomainMismatch');
7070
}
7171

72+
it('should always return a valid value for `intervalMS`', function() {
73+
const poller = new SrvPoller({ srvHost: SRV_HOST });
74+
expect(poller)
75+
.property('intervalMS')
76+
.to.equal(60000);
77+
});
78+
7279
describe('success', function() {
7380
it('should emit event, disable haMode, and schedule another poll', function(done) {
7481
const records = [srvRecord('jalad.tanagra.com'), srvRecord('thebeast.tanagra.com')];

0 commit comments

Comments
 (0)