re-add magic timeouts

also remove a problematic line that broke more than it helped
This commit is contained in:
modeco80
2024-07-11 03:33:19 -04:00
parent 25b32b23b7
commit 7423c62957

View File

@@ -214,7 +214,7 @@ export class QemuVM extends EventEmitter {
this.qemuProcess.on('spawn', async () => { this.qemuProcess.on('spawn', async () => {
self.VMLog().Info('QEMU started'); self.VMLog().Info('QEMU started');
await Shared.Sleep(250); await Shared.Sleep(500);
await self.ConnectQmp(); await self.ConnectQmp();
}); });
@@ -237,7 +237,7 @@ export class QemuVM extends EventEmitter {
if (self.state != VMState.Stopping) { if (self.state != VMState.Stopping) {
if (code == 0) { if (code == 0) {
// Wait a bit and restart QEMU. // Wait a bit and restart QEMU.
await Shared.Sleep(250); await Shared.Sleep(500);
await self.StartQemu(split); await self.StartQemu(split);
} else { } else {
self.VMLog().Error('QEMU exited with a non-zero exit code. This usually means an error in the command line. Stopping VM.'); self.VMLog().Error('QEMU exited with a non-zero exit code. This usually means an error in the command line. Stopping VM.');
@@ -267,11 +267,10 @@ export class QemuVM extends EventEmitter {
return; return;
} }
await Shared.Sleep(500);
this.qmpSocket = connect(this.GetQmpPath()); this.qmpSocket = connect(this.GetQmpPath());
this.qmpSocket.on('close', async () => { this.qmpSocket.on('close', async () => {
self.qmpSocket?.removeAllListeners();
if (self.qmpConnected) { if (self.qmpConnected) {
await self.DisconnectQmp(); await self.DisconnectQmp();
@@ -279,7 +278,7 @@ export class QemuVM extends EventEmitter {
if (self.state != VMState.Stopping) { if (self.state != VMState.Stopping) {
if (self.qmpFailCount++ < kMaxFailCount) { if (self.qmpFailCount++ < kMaxFailCount) {
self.VMLog().Error(`Failed to connect to QMP ${self.qmpFailCount} times.`); self.VMLog().Error(`Failed to connect to QMP ${self.qmpFailCount} times.`);
await Shared.Sleep(250); await Shared.Sleep(500);
await self.ConnectQmp(); await self.ConnectQmp();
} else { } else {
self.VMLog().Error(`Reached max retries, giving up.`); self.VMLog().Error(`Reached max retries, giving up.`);