mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-15 09:58:45 -07:00
Fix "Possible EventEmitter memory leak detected. 1001 drain listeners added to [Socket]" warning. #9822
This commit is contained in:
parent
82f5ddb748
commit
c2d9ffa7ad
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user