High CPU usage / make async?
Closed this issue · 2 comments
chrisheib commented
Describe the bug
Hi! Firstly thanks for the crate, very useful! I am using this in https://github.com/chrisheib/STStat to do a ping every second to measure network quality. It looks like ekko blocks on sending pings, wasting a lot of cycles - is that correct? Would implementing the networking with async abstraction like tokio solve this?
Steps to reproduce the bug
- Be on a really bad network with ping times > 500ms
- Send a ping
- Watch the CPU spike
Expected behavior
Ekko yields, not using a lot of ressources until the response or timeout occured.
dev-bio commented
Thank you!
Missing a yield in the polling loop, will get back to this some time today.
For use in an asynchronous context I suggest spawning a blocking thread for now, or a dedicated thread with a one-shot channel.