fix(installer): fall back to Config on detection timeout when install.json exists
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
@@ -29,7 +28,13 @@ public partial class App : Application
|
||||
|
||||
// Default install dir for detection — on upgrade we stay where we were.
|
||||
var detector = _services.GetRequiredService<InstallModeDetector>();
|
||||
var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
|
||||
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
|
||||
|
||||
// Read manifest up front so we can fall back to Config if the API times out
|
||||
// on an existing install. If the API is slow, we do NOT want to drop an
|
||||
// already-installed user into FreshInstall — that would risk overwriting them.
|
||||
var existingManifest = InstallManifestStore.TryRead(context.InstallDirectory);
|
||||
|
||||
DetectedState state;
|
||||
try
|
||||
{
|
||||
@@ -37,7 +42,9 @@ public partial class App : Application
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
state = new DetectedState(InstallerMode.FreshInstall, null, null, null);
|
||||
state = existingManifest is not null
|
||||
? new DetectedState(InstallerMode.Config, existingManifest, null, null)
|
||||
: new DetectedState(InstallerMode.FreshInstall, null, null, null);
|
||||
}
|
||||
|
||||
context.Mode = state.Mode;
|
||||
|
||||
Reference in New Issue
Block a user