()
| 320 | } |
| 321 | |
| 322 | function startLauncherHealthMonitor() { |
| 323 | if (launcherHealthTimer) { |
| 324 | return |
| 325 | } |
| 326 | |
| 327 | launcherHealthTimer = setInterval(async () => { |
| 328 | if (restartingLauncher || !mainWindow || mainWindow.isDestroyed()) { |
| 329 | return |
| 330 | } |
| 331 | |
| 332 | try { |
| 333 | const response = await fetch(`${uiUrl}/api/state`) |
| 334 | if (!response.ok) { |
| 335 | throw new Error(`Host returned ${response.status}`) |
| 336 | } |
| 337 | } catch { |
| 338 | await restartLauncher('Local host was unreachable. Restarting it now...') |
| 339 | } |
| 340 | }, 5000) |
| 341 | } |
| 342 | |
| 343 | function stopLauncherHealthMonitor() { |
| 344 | if (launcherHealthTimer) { |
no test coverage detected