-
-
Notifications
You must be signed in to change notification settings - Fork 455
Add ConfigureWait and cancellation token & remove unnecessary OperationCanceledException #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| try | ||
| { | ||
| for (var index = 0; index < results.Count; index++) | ||
| await Task.Run(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
taooceros
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Work!
taooceros
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice Work!
Uh oh!
There was an error while loading. Please reload this page.