tmux-plugins / tmux-net-speed

Tmux plugin to monitor upload and download speed of one or all interfaces
MIT License
85 stars 23 forks source link

Cache results to prevent miscalculations #13

Closed jgeralnik closed 7 months ago

jgeralnik commented 3 years ago

The code assumes that the status bar will only be updated every status-interval seconds

In practice status-interval is a maximum value, not a minimum value. So if the status bar is actually updated every second even though the configuration is for 5 seconds all of the calculations are off and the bitrate will be calculated as a fifth of the real rate.

See https://github.com/tmux-plugins/tmux-cpu/issues/15 for a similar issue with a different plugin, except that here it is much worse because it actually leads to a WRONG RESULT and not just a faster update. This commit implements @BrainMaestro 's suggestion from that thread.

Has some file spam for keeping track of everything needed but I'm only adding to an existing problem.