fix connectivity check cancellation (#3184)

This commit is contained in:
Matt 2024-10-16 23:03:41 +01:00 committed by GitHub
parent d4d41bdd4f
commit f19cc05ffb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,7 +86,7 @@
if (finishedTask.IsFaulted)
exceptions.Add(finishedTask.Exception!.InnerException!);
else
else if (!finishedTask.IsCanceled)
BaseUrl = finishedTask.Result;
}
@ -94,7 +94,11 @@
tokenSource.Cancel();
if (string.IsNullOrEmpty(BaseUrl))
{
if (exceptions.Any())
return exceptions[0];
return new TaskCanceledException("All tasks have been cancelled"); // we can't add TaskCanceledExceptions to the list
}
App.Logger.WriteLine(LOG_IDENT, $"Got {BaseUrl} as the optimal base URL");