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.
This commit is contained in:
Goffi 2024-09-06 17:38:31 +02:00
commit 0a8bb228d5

View file

@ -141,8 +141,9 @@ def install_glib_asyncio_iteration():
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)