Closed tuxedoxt closed 6 months ago
Bump :)
Any feedback?
This approach looks better, but I have to try it. I will next weekend, promised. In the mean time, can you add some unit test?
This seems to do it for my current issue in #35.
@tuxedoxt How did you get the error to stop? I tried using your fork and calling await device.disconnect()
, but I still got error.
Related issue, after calling Adapter.devices in a loop once every 5 seconds I start to get (node:4278) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 {"path":"/org/bluez/hci0/dev_6C_EC_26_F4_E4_5C","interface":"org.freedesktop.DBus.Properties","member":"PropertiesChanged"} listeners added to [EventEmitter]. Use emitter.setMaxListeners() to increase limit
This is the code in question, called from a setInterval
loop every 5 seconds.
const devices = await adapter.devices();
for (let i = 0; i < devices.length; i++) {
try {
const device = await adapter.getDevice(devices[i]);
const name = await device.getName();
const rssi = await device.getRSSI();
await device.disconnect();
...
I've tried the changes in this PR but they didn't affect the error.
@tuxedoxt How did you get the error to stop? I tried using your fork and calling
await device.disconnect()
, but I still got error.
I ended up using this change combined with https://github.com/dbusjs/node-dbus-next/pull/110
Since none got merged still using the forked versions explicitly binding the github urls in package.json
where needed.
Example, temporary forked node-ble which has this change and a reference to forked dbus-next change:
"node-ble": "git+https://github.com/tuxedoxt/node-ble.git#match-and-event-leak-fixes",
Any chance this will get merged soon?
Another bump :)
@chrvadala
@chrvadala
Released with v1.10
Hello,
if the intended use of
Device.disconnect
also is to clean up the remaining event listeners this PR extends this to include the leftoverBusHelper._propsProxy
event listeners adding a new functionBusHelper.removeListeners
for this purpose.This seems to do it for my current issue in #35.