File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Flow.Launcher.Core/Plugin
Flow.Launcher.Plugin/Interfaces Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -165,7 +165,8 @@ public static async Task InitializePluginsAsync()
165165 {
166166 var failedPlugins = new ConcurrentQueue < PluginPair > ( ) ;
167167
168- var InitTasks = AllPlugins . Select ( pair => Task . Run ( async delegate
168+ // Some plugins should not be initialized in task, so we cannot use Task.WhenAll here
169+ foreach ( var pair in AllPlugins )
169170 {
170171 try
171172 {
@@ -182,9 +183,7 @@ public static async Task InitializePluginsAsync()
182183 pair . Metadata . Disabled = true ;
183184 failedPlugins . Enqueue ( pair ) ;
184185 }
185- } ) ) ;
186-
187- await Task . WhenAll ( InitTasks ) ;
186+ }
188187
189188 _contextMenuPlugins = GetPluginsForInterface < IContextMenu > ( ) ;
190189 foreach ( var plugin in AllPlugins )
Original file line number Diff line number Diff line change @@ -30,7 +30,12 @@ public interface IPlugin : IAsyncPlugin
3030 /// <param name="context"></param>
3131 void Init ( PluginInitContext context ) ;
3232
33- Task IAsyncPlugin . InitAsync ( PluginInitContext context ) => Task . Run ( ( ) => Init ( context ) ) ;
33+ async Task IAsyncPlugin . InitAsync ( PluginInitContext context )
34+ {
35+ // Some plugins should not be initialized in task
36+ Init ( context ) ;
37+ await Task . CompletedTask ;
38+ }
3439
3540 Task < List < Result > > IAsyncPlugin . QueryAsync ( Query query , CancellationToken token ) => Task . Run ( ( ) => Query ( query ) ) ;
3641 }
You can’t perform that action at this time.
0 commit comments