Skip to content

Conversation

@arjunbalgovind
Copy link
Contributor

@arjunbalgovind arjunbalgovind commented Aug 6, 2020

Summary of the Pull Request

What is this about?
This PR adds in a new interface to for plugins which take longer to execute. If the flag in metadata is set to true, two versions of the plugin get executed, first a fast version along with the other plugins and then a slower version after all the other plugins had finished.

PR Checklist

Info on Pull Request

What does this include?

  • IDelayedExecutionPlugin and DelayedExecution flag were added to metadata. If a plugin uses this flag and implements this interface it can be used with similar behavior to indexer plugin.
  • For indexer we use a regex to filter out the LIKE query part of the SQL query. Initially while running all the plugins we run this faster version of indexer. After updating the list view with those results, we run each DelayedExecution plugin one by one and update the results along with it. If there is no change in the sql query after checking for LIKE query we do not update any results with the second query.
  • Adding scoring for indexer plugin as 0, -1, -2, etc., to ensure that ordering is maintained
  • Removed _lock in WindowsSearchAPI since there could be multiple instances of indexer query occurring. To avoid the error from OleDB throwing exceptions in ExecuteReader (https://github.com/microsoft/Launcher/pull/70) we add checks for whether the reader is closed. While testing, the exceptions were generally occurring only on the older queries which would get cancelled eventually. Otherwise this would cause the slower query from a previous execution to block the list view from updating when the next query is made since it will wait even for the fast indexer plugin.

Validation Steps Performed

How does someone test & validate?

  • Tests passed and added tests for SimplifyQuery method.
  • Tested manually by adding artificial Thread.Sleep in the indexer plugin.

@arjunbalgovind arjunbalgovind added the Product-PowerToys Run Improved app launch PT Run (Win+R) Window label Aug 10, 2020
@arjunbalgovind arjunbalgovind changed the title User/arbalgov/indexer query helper Split indexer plugin's queries into a fast and slow query Aug 10, 2020
@arjunbalgovind arjunbalgovind requested a review from a team August 10, 2020 20:33
@arjunbalgovind arjunbalgovind marked this pull request as ready for review August 10, 2020 20:33
@arjunbalgovind arjunbalgovind changed the title Split indexer plugin's queries into a fast and slow query [PT Run] Split indexer plugin's queries into a fast and slow query Aug 10, 2020
Copy link
Contributor

@dsrivastavv dsrivastavv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Product-PowerToys Run Improved app launch PT Run (Win+R) Window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants