Open endreszabo opened 4 years ago
What model of pi are you using here? On a pi4 I am seeing around 2% usage of a single core, so not a very significant load.
My only concern with this is that it will mean we have to be very careful to ensure the timer gets started and stopped at the right times. That said I'm not opposed to this, but it'll need to be well tested before being merged into a release version
I'm submitting a ... [ ] bug report [x] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
Summary
I'm running this lib in a simple script on a relatively low performance Raspberry PI and after a week of runtime I noticed that the node processes using
atem-connection
has high (8% average) overall CPU usage. Here is my proposal.I dug down deep and found that this timer called
_retransmitTimer
fires every 10 milliseconds a function called_checkForRetransmit
to check if there is any packets to resend (or reconnect if stuck, etc).Since all its logic depends on the members of the
_inFlight
array, I would kindly ask to enable the timer only when there are actual packets referenced in this array, and close() it once all packets are sent. This would also affect thestartTimers
function which creates this timer right after connecting. This way we can spare CPU time.If busy I'm happy to create a PR later but first I'll have to get familiar with TS.