From 34dd61c80cd3a6188a22eeacde7f7fe9fae43e2a Mon Sep 17 00:00:00 2001 From: catborise Date: Thu, 5 Nov 2026 18:39:41 +0300 Subject: [PATCH] perf(console): a serial console asks for its VM's state once a second Its worker asked libvirt for the VM's state five times a second, up to 100 calls a second with 20 consoles open, only to notice a start or a stop. Once a second is enough: output and keys do not wait for it. --- conf/daemon/consolecallback | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conf/daemon/consolecallback b/conf/daemon/consolecallback index e8e659d5..c7d60236 100755 --- a/conf/daemon/consolecallback +++ b/conf/daemon/consolecallback @@ -133,8 +133,10 @@ def main(): libvirt.virEventAddHandle(0, libvirt.VIR_EVENT_HANDLE_READABLE, from_client, console) checked = time.monotonic() try: + # a VM's start or stop shows within a second; its output and the + # user's keys travel through libvirt's event loop, not this one while console.running: - time.sleep(0.2) + time.sleep(1) console.check() if time.monotonic() - checked > ACCESS_CHECK: if not may_still_open(user_id, instance):