stackhero-io / node-red-contrib-stackhero-influxdb-v2

Node-RED node to read and write to an InfluxDB v2 database.
31 stars 7 forks source link

Add listener count to avoid emitter leak warning #22

Open pmacostapdi opened 1 year ago

pmacostapdi commented 1 year ago

When multiple write nodes are placed in one flow the logs show a warning of the kind:

(node:31) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 stateWrite listeners added to [InfluxDbV2Node]. Use emitter.setMaxListeners() to increase limit

This one-liner increases the maximum number of listeners right before the listener is hooked up and thus no warning is generated.