Add ConfigureWait and cancellation token & remove unnecessary OperationCanceledException#387
Add ConfigureWait and cancellation token & remove unnecessary OperationCanceledException#387
Conversation
| try | ||
| { | ||
| for (var index = 0; index < results.Count; index++) | ||
| await Task.Run(() => |
There was a problem hiding this comment.
I would say that we don't need the Task.Run because we don't need to filter result in another thread. It is sync code so using a Task.Run won't create better performance. We just need to add the token.Throw here, and this method don't need to be asynchronous.
The OperationCancelledException is supposed to be catched by PluginManager, so no need to add another try catch here. I try to do that in WebSearch plugin because I have encoutered debugging latency (the latency only appears when debugger attach, and I haven't found a great way to resolve that), but seems that simply catching the result won't solve that issue. Therefore, no need to do that.
There was a problem hiding this comment.
The OperationCancelledException is supposed to be catched by PluginManager, so no need to add another try catch here.
There is a try catch in IndexSearch class, how come that needs it?
There was a problem hiding this comment.
I would say no need for that, but since there already contains a try catch for ODBC exception, I add it. We can remove it to keep code cleaner.
There was a problem hiding this comment.
Sounds good, I will do that. So overall, there is no need to catch token cancellation thrown exception in plugins, because it will be caught by the PluginManager, correct?
There was a problem hiding this comment.
Correct. Exception thrown is by design to avoid result return, so no need to catch them inside any plugin.
Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
Outdated
Show resolved
Hide resolved
Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
Outdated
Show resolved
Hide resolved
Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
Outdated
Show resolved
Hide resolved
Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
Outdated
Show resolved
Hide resolved
Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
Outdated
Show resolved
Hide resolved
Plugins/Flow.Launcher.Plugin.Explorer/Search/WindowsIndex/IndexSearch.cs
Outdated
Show resolved
Hide resolved
|
@taooceros done, please review |
Uh oh!
There was an error while loading. Please reload this page.