mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Refactor plugin enabled check with thread safety
Extract plugin enabled check into a new CheckPlugin method, adding a lock for thread safety. Update the if statement to use this method instead of inline logic.
This commit is contained in:
parent
17d675e5ce
commit
211eb8a747
1 changed files with 9 additions and 2 deletions
|
|
@ -35,8 +35,7 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
string possibleActionKeyword = terms[0];
|
string possibleActionKeyword = terms[0];
|
||||||
string[] searchTerms;
|
string[] searchTerms;
|
||||||
|
|
||||||
if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPairs)
|
if (nonGlobalPlugins.TryGetValue(possibleActionKeyword, out var pluginPairs) && CheckPlugin(pluginPairs))
|
||||||
&& pluginPairs.Any(plugin => !plugin.Metadata.Disabled))
|
|
||||||
{
|
{
|
||||||
// use non global plugin for query
|
// use non global plugin for query
|
||||||
actionKeyword = possibleActionKeyword;
|
actionKeyword = possibleActionKeyword;
|
||||||
|
|
@ -61,5 +60,13 @@ namespace Flow.Launcher.Core.Plugin
|
||||||
IsHomeQuery = false
|
IsHomeQuery = false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool CheckPlugin(List<PluginPair> pluginPairs)
|
||||||
|
{
|
||||||
|
lock (pluginPairs)
|
||||||
|
{
|
||||||
|
return pluginPairs.Any(plugin => !plugin.Metadata.Disabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue