Skip to content

Commit 16e7064

Browse files
authored
fix(sdam): topology no longer causes close event (#2791)
The topology was emitting both a "topologyClosed" and "close" event which are bubbled up to the MongoClient. This was causing two "close" events to be emitted from the MongoClient when the client is closed. NODE-3219
1 parent 971259a commit 16e7064

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

lib/core/sdam/topology.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ class Topology extends EventEmitter {
359359
this.emit('topologyClosed', new events.TopologyClosedEvent(this.s.id));
360360

361361
stateTransition(this, STATE_CLOSED);
362-
this.emit('close');
363362

364363
if (typeof callback === 'function') {
365364
callback(err);

test/functional/operation_example.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3688,10 +3688,9 @@ describe('Operation Examples', function() {
36883688
// REMOVE-LINE done();
36893689
// REMOVE-LINE var db = client.db(configuration.db);
36903690
// BEGIN
3691-
var db = client.db(configuration.db);
36923691
test.equal(null, err);
36933692

3694-
db.on('close', function() {
3693+
client.on('close', function() {
36953694
done();
36963695
});
36973696

0 commit comments

Comments
 (0)