node-ble
node-ble copied to clipboard
Fix memory leak in waitDevice method
In the waitDevice method, if the device is not found the 'operation timed out' error is thrown but the interval is not cleared. I added a try and finally statements for avoid this problem.
Hello @chrvadala,
Please let us know when you plan to have a look at this PR by @Raffone17. Thank you!
Thanks for this PR guys, can you integrate it with a test?
I see that the fix makes completely sense, but it is better to cover this case with a test.
You can mock getDevice for that. It seems the easier solution
Hello @chrvadala, I did a unit test that covers the scenario.
@chrvadala I made the requested changes.
Released with v1.12.0 Thanks @Raffone17 and @gmacario for your help on this project