mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
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.
This commit is contained in:
parent
51aa712802
commit
34dd61c80c
1 changed files with 3 additions and 1 deletions
|
|
@ -133,8 +133,10 @@ def main():
|
||||||
libvirt.virEventAddHandle(0, libvirt.VIR_EVENT_HANDLE_READABLE, from_client, console)
|
libvirt.virEventAddHandle(0, libvirt.VIR_EVENT_HANDLE_READABLE, from_client, console)
|
||||||
checked = time.monotonic()
|
checked = time.monotonic()
|
||||||
try:
|
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:
|
while console.running:
|
||||||
time.sleep(0.2)
|
time.sleep(1)
|
||||||
console.check()
|
console.check()
|
||||||
if time.monotonic() - checked > ACCESS_CHECK:
|
if time.monotonic() - checked > ACCESS_CHECK:
|
||||||
if not may_still_open(user_id, instance):
|
if not may_still_open(user_id, instance):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue