fix:心跳机制

This commit is contained in:
2026-03-14 16:04:01 +08:00
parent d330d0bf26
commit 3354850216
+15 -1
View File
@@ -1253,7 +1253,20 @@ namespace Ink_Canvas
} }
} }
if (isStartupComplete && (DateTime.Now - lastHeartbeat).TotalSeconds > 10) if (isStartupComplete)
{
var now = DateTime.Now;
var sinceHeartbeat = now - lastHeartbeat;
var sinceStartupComplete = startupCompleteHeartbeat == DateTime.MinValue
? TimeSpan.Zero
: now - startupCompleteHeartbeat;
if (sinceStartupComplete.TotalSeconds < 30)
{
return;
}
if (sinceHeartbeat.TotalSeconds > 10)
{ {
LogHelper.NewLog("检测到主线程无响应,自动重启。"); LogHelper.NewLog("检测到主线程无响应,自动重启。");
SyncCrashActionFromSettings(); SyncCrashActionFromSettings();
@@ -1275,6 +1288,7 @@ namespace Ink_Canvas
Environment.Exit(1); Environment.Exit(1);
} }
} }
}
}, null, 0, 3000); }, null, 0, 3000);
} }