# HG changeset patch # User Goffi # Date 1725637111 -7200 # Node ID 7d98d894933c53dfc45fa285fb03f7ada5a91232 # Parent a0ed5c976bf87c3f3cd99fc2ac3878fc785e093d frontends (tools/aio): Fix excessive use of CPU: Use a short delay instead of `loop.call_soonloop.call_soon` when work as been done, as this was resulting in an excessive use of CPU. diff -r a0ed5c976bf8 -r 7d98d894933c libervia/frontends/tools/aio.py --- a/libervia/frontends/tools/aio.py Tue Aug 06 23:43:11 2024 +0200 +++ b/libervia/frontends/tools/aio.py Fri Sep 06 17:38:31 2024 +0200 @@ -141,8 +141,9 @@ if iteration_count == 0: loop.call_later(0.01, _glib_iteration) else: - # Schedule ourselves to run again on the next asyncio loop iteration - loop.call_soon(_glib_iteration) + # Work has been done, and there may still be some. Use a shorter delay to + # schedule ourselves again. + loop.call_later(0.001, _glib_iteration) # Kick off the GLib iteration loop.call_soon(_glib_iteration)