@@ -1207,19 +1207,19 @@ private async Task QueryResultsAsync(int? searchDelay, bool isReQuery = false, b
12071207 }
12081208
12091209 // Local function
1210- async ValueTask QueryTaskAsync ( PluginPair plugin , bool reSelect = true )
1210+ async Task QueryTaskAsync ( bool searchDelay , PluginPair plugin , bool reSelect , CancellationToken token )
1211+ {
1212+ if ( ! searchDelay )
12111213 {
12121214 // Since it is wrapped within a ThreadPool Thread, the synchronous context is null
12131215 // Task.Yield will force it to run in ThreadPool
12141216 await Task . Yield ( ) ;
1215-
1216- if ( _updateSource . Token . IsCancellationRequested )
1217- return ;
1217+ }
12181218
12191219 IReadOnlyList < Result > results =
1220- await PluginManager . QueryForPluginAsync ( plugin , query , _updateSource . Token ) ;
1220+ await PluginManager . QueryForPluginAsync ( plugin , query , token ) ;
12211221
1222- if ( _updateSource . Token . IsCancellationRequested )
1222+ if ( token . IsCancellationRequested )
12231223 return ;
12241224
12251225 IReadOnlyList < Result > resultsCopy ;
@@ -1230,11 +1230,11 @@ async ValueTask QueryTaskAsync(PluginPair plugin, bool reSelect = true)
12301230 else
12311231 {
12321232 // make a copy of results to avoid possible issue that FL changes some properties of the records, like score, etc.
1233- resultsCopy = DeepCloneResults ( results ) ;
1233+ resultsCopy = DeepCloneResults ( results , token ) ;
12341234 }
12351235
12361236 if ( ! _resultsUpdateChannelWriter . TryWrite ( new ResultsForUpdate ( resultsCopy , plugin . Metadata , query ,
1237- _updateSource . Token , reSelect ) ) )
1237+ token , reSelect ) ) )
12381238 {
12391239 Log . Error ( "MainViewModel" , "Unable to add item to Result Update Queue" ) ;
12401240 }
0 commit comments