mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
fix(console): a serial console waiting for its VM to start checks five times a second
The worker checked its VM's state once a second (34dd61c8); a VM started
while its console was open could lose up to a second of its first output
(the BIOS banner, a boot menu) before the stream opened. A VM that is not
running is checked five times a second again; one that runs stays at once
a second.
This commit is contained in:
parent
fd60851a28
commit
26683b28ed
1 changed files with 4 additions and 3 deletions
|
|
@ -133,10 +133,11 @@ 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
|
||||
# its output and the user's keys travel through libvirt's event loop,
|
||||
# not this one; a VM that runs is checked once a second, one that does
|
||||
# not five times, so that its first output after a start is not lost
|
||||
while console.running:
|
||||
time.sleep(1)
|
||||
time.sleep(1 if console.active else 0.2)
|
||||
console.check()
|
||||
if time.monotonic() - checked > ACCESS_CHECK:
|
||||
if not may_still_open(user_id, instance):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue