Skip to content

Conversation

@jjw24
Copy link
Member

@jjw24 jjw24 commented May 27, 2021

When a plugin has multiple global action keywords, flow loops through the plugin's global (*) and action keywords and fire them off to query. This creates a scenario where a plugin with multiple global action keywords (*), for example 4, running the plugin search 4 times unnecessarily. This also could potentially have a performance cost to it.

This fix excludes adding multiple duplicate global and action keywords even if the plugin has 4 global action keywords, only fire search once.

@jjw24 jjw24 added the bug Something isn't working label May 27, 2021
@jjw24 jjw24 self-assigned this May 27, 2021
@jjw24 jjw24 enabled auto-merge May 27, 2021 22:49
@taooceros
Copy link
Member

taooceros commented May 28, 2021

why not just make GlobalPlugins a hashset? that can also fix sometimes people trying to add global actionkeyword twice.

Use HashSet instead of List to avoid duplicate global plugin
@taooceros
Copy link
Member

I finish the edit for HashSet because I would like to make some further change based on this branch.

I found that await Task.Yield won't actually run task in threadpool, so maybe we shouldn't use it here.
When I try to replace the Task.Run with await Task.Yield in Program plugin, it add 10-15ms delay for returning result. Maybe we should assume every async plugins are doing right thing so that we can simply remove the await Task.Yield and let it run sync.

@jjw24
Copy link
Member Author

jjw24 commented May 29, 2021

lgtm, did you want to approve?

@taooceros
Copy link
Member

Sorry I am reinstalling windows today. Will do it now

@jjw24 jjw24 merged commit ad98e8f into dev May 30, 2021
@jjw24 jjw24 deleted the fix_duplicate_query_search branch May 30, 2021 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants