mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-26 04:29:58 +00:00
Fix "Possible EventEmitter memory leak detected. 1001 drain listeners added to [Socket]" warning. #9822
This commit is contained in:
@@ -69,6 +69,7 @@ export default class MQTT {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
this.client = mqtt.connect(mqttSettings.server, options);
|
||||
this.client.setMaxListeners(0);
|
||||
|
||||
const onConnect = this.onConnect;
|
||||
this.client.on('connect', async () => {
|
||||
|
||||
@@ -6,6 +6,7 @@ const mock = {
|
||||
subscribe: jest.fn(),
|
||||
reconnecting: false,
|
||||
on: jest.fn(),
|
||||
setMaxListeners: jest.fn(),
|
||||
};
|
||||
|
||||
const mockConnect = jest.fn().mockReturnValue(mock);
|
||||
|
||||
Reference in New Issue
Block a user