mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use null as flag to report community source error
This commit is contained in:
parent
1b0c114255
commit
dd61ab43cb
2 changed files with 12 additions and 8 deletions
|
|
@ -16,12 +16,12 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
|||
{
|
||||
public record CommunityPluginSource(string ManifestFileUrl)
|
||||
{
|
||||
private static readonly string ClassName = nameof(CommunityPluginSource);
|
||||
|
||||
// We should not initialize API in static constructor because it will create another API instance
|
||||
private static IPublicAPI api = null;
|
||||
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
|
||||
|
||||
private static readonly string ClassName = nameof(CommunityPluginSource);
|
||||
|
||||
private string latestEtag = "";
|
||||
|
||||
private List<UserPlugin> plugins = new();
|
||||
|
|
@ -70,7 +70,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
|||
else
|
||||
{
|
||||
API.LogWarn(ClassName, $"Failed to load resource {ManifestFileUrl} with response {response.StatusCode}");
|
||||
return plugins;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
|
@ -83,7 +83,7 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
|||
{
|
||||
API.LogException(ClassName, "Error Occurred", e);
|
||||
}
|
||||
return plugins;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,10 +40,14 @@ namespace Flow.Launcher.Core.ExternalPlugins
|
|||
var completedTask = await Task.WhenAny(tasks);
|
||||
if (completedTask.IsCompletedSuccessfully)
|
||||
{
|
||||
// one of the requests completed successfully; keep its results
|
||||
// and cancel the remaining http requests.
|
||||
pluginResults = await completedTask;
|
||||
cts.Cancel();
|
||||
var result = await completedTask;
|
||||
if (result != null)
|
||||
{
|
||||
// one of the requests completed successfully; keep its results
|
||||
// and cancel the remaining http requests.
|
||||
pluginResults = result;
|
||||
cts.Cancel();
|
||||
}
|
||||
}
|
||||
tasks.Remove(completedTask);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue