[Settings] Do not try to apply profile settings if there was a timeout (#16933)

This commit is contained in:
Andrey Nekrasov
2022-03-10 20:31:16 +03:00
committed by GitHub
parent 309a0661c3
commit a8fb9e0804
2 changed files with 22 additions and 7 deletions

View File

@@ -273,16 +273,23 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
});
t.Wait(1000, ts.Token);
var completedInTime = t.Wait(3000, ts.Token);
ts.Cancel();
ts.Dispose();
if (!readSuccessfully)
if (readSuccessfully)
{
FilterRemapKeysList(_profile?.RemapKeys?.InProcessRemapKeys);
}
else
{
success = false;
}
FilterRemapKeysList(_profile?.RemapKeys?.InProcessRemapKeys);
if (!completedInTime)
{
Logger.LogError($"Timeout encountered when loading {PowerToyName} profile");
}
}
catch (Exception e)
{
@@ -291,6 +298,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
success = false;
}
if (!success)
{
Logger.LogError($"Couldn't load {PowerToyName} profile");
}
return success;
}
}