Skip to content

Commit

Permalink
Remove close listener before next startStreamProcess loop
Browse files Browse the repository at this point in the history
This cause memory leak during fast publishing when leveldb store is used
```VM38 warning.js:27 (node:2090114) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 close listeners added to [MqttClient]. Use emitter.setMaxListeners() to increase limit```
  • Loading branch information
patrykwegrzyn authored Jan 30, 2020
1 parent 020ebfd commit f9a8c28
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1448,6 +1448,7 @@ MqttClient.prototype._onConnect = function (packet) {
that.removeListener('close', remove)
that.emit('connect', packet)
} else {
that.removeListener('close', remove)
startStreamProcess()
}
})
Expand Down

0 comments on commit f9a8c28

Please sign in to comment.