mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Save init failed plugins
This commit is contained in:
parent
7f797b1039
commit
fc01ddbb1c
1 changed files with 4 additions and 5 deletions
|
|
@ -31,6 +31,7 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
|
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
|
||||||
|
|
||||||
private static List<PluginPair> _allLoadedPlugins;
|
private static List<PluginPair> _allLoadedPlugins;
|
||||||
|
private static readonly ConcurrentDictionary<string, PluginPair> _initFailedPlugins = [];
|
||||||
private static readonly ConcurrentDictionary<string, PluginPair> _allInitializedPlugins = [];
|
private static readonly ConcurrentDictionary<string, PluginPair> _allInitializedPlugins = [];
|
||||||
private static readonly ConcurrentDictionary<string, PluginPair> _globalPlugins = [];
|
private static readonly ConcurrentDictionary<string, PluginPair> _globalPlugins = [];
|
||||||
private static readonly ConcurrentDictionary<string, PluginPair> _nonGlobalPlugins = [];
|
private static readonly ConcurrentDictionary<string, PluginPair> _nonGlobalPlugins = [];
|
||||||
|
|
@ -240,8 +241,6 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
/// <returns>return the list of failed to init plugins or null for none</returns>
|
/// <returns>return the list of failed to init plugins or null for none</returns>
|
||||||
public static async Task InitializePluginsAsync(IResultUpdateRegister register)
|
public static async Task InitializePluginsAsync(IResultUpdateRegister register)
|
||||||
{
|
{
|
||||||
var failedPlugins = new ConcurrentQueue<PluginPair>();
|
|
||||||
|
|
||||||
var initTasks = _allLoadedPlugins.Select(pair => Task.Run(async () =>
|
var initTasks = _allLoadedPlugins.Select(pair => Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -266,7 +265,7 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
{
|
{
|
||||||
pair.Metadata.Disabled = true;
|
pair.Metadata.Disabled = true;
|
||||||
pair.Metadata.HomeDisabled = true;
|
pair.Metadata.HomeDisabled = true;
|
||||||
failedPlugins.Enqueue(pair);
|
_initFailedPlugins.TryAdd(pair.Metadata.ID, pair);
|
||||||
API.LogDebug(ClassName, $"Disable plugin <{pair.Metadata.Name}> because init failed");
|
API.LogDebug(ClassName, $"Disable plugin <{pair.Metadata.Name}> because init failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -294,9 +293,9 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
|
|
||||||
await Task.WhenAll(initTasks);
|
await Task.WhenAll(initTasks);
|
||||||
|
|
||||||
if (!failedPlugins.IsEmpty)
|
if (!_initFailedPlugins.IsEmpty)
|
||||||
{
|
{
|
||||||
var failed = string.Join(",", failedPlugins.Select(x => x.Metadata.Name));
|
var failed = string.Join(",", _initFailedPlugins.Values.Select(x => x.Metadata.Name));
|
||||||
API.ShowMsg(
|
API.ShowMsg(
|
||||||
API.GetTranslation("failedToInitializePluginsTitle"),
|
API.GetTranslation("failedToInitializePluginsTitle"),
|
||||||
string.Format(
|
string.Format(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue