Skip to content

Commit ee0db01

Browse files
committed
fix(close): the unified topology emits a close event on close now
1 parent 0b7788e commit ee0db01

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/operations/close.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
const Aspect = require('./operation').Aspect;
44
const defineAspects = require('./operation').defineAspects;
55
const OperationBase = require('./operation').OperationBase;
6+
const NativeTopology = require('../topologies/native_topology');
67

78
class CloseOperation extends OperationBase {
89
constructor(client, force) {
@@ -16,8 +17,11 @@ class CloseOperation extends OperationBase {
1617
const force = this.force;
1718
const completeClose = err => {
1819
client.emit('close', client);
19-
for (const item of client.s.dbCache) {
20-
item[1].emit('close', client);
20+
21+
if (!(client.topology instanceof NativeTopology)) {
22+
for (const item of client.s.dbCache) {
23+
item[1].emit('close', client);
24+
}
2125
}
2226

2327
client.removeAllListeners('close');

0 commit comments

Comments
 (0)