dev-bio/ekko

High CPU usage / make async?

Closed this issue · 2 comments

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

  1. Be on a really bad network with ping times > 500ms
  2. Send a ping
  3. Watch the CPU spike

Expected behavior

Ekko yields, not using a lot of ressources until the response or timeout occured.

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.

Sorry for the delay, published a new version and updated some dependencies.

9fa9d70