File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,8 @@ async Task UpdateActionAsync()
212212 await Task . Delay ( 20 ) ;
213213 while ( channelReader . TryRead ( out var item ) )
214214 {
215- if ( ! item . Token . IsCancellationRequested )
215+ // If this update task is for clearing existing results, we must need to add it to the queue
216+ if ( ! item . Token . IsCancellationRequested || item . shouldClearExistingResults )
216217 queue [ item . ID ] = item ;
217218 }
218219
@@ -1861,12 +1862,21 @@ public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates)
18611862 {
18621863 if ( ! resultsForUpdates . Any ( ) )
18631864 return ;
1865+
18641866 CancellationToken token ;
18651867
18661868 try
18671869 {
1868- // Don't know why sometimes even resultsForUpdates is empty, the method won't return;
1869- token = resultsForUpdates . Select ( r => r . Token ) . Distinct ( ) . SingleOrDefault ( ) ;
1870+ // If there are any update tasks for clearing existing results, we need to set token to default so that it will not be cancelled
1871+ if ( resultsForUpdates . Any ( r => r . shouldClearExistingResults ) )
1872+ {
1873+ token = default ;
1874+ }
1875+ else
1876+ {
1877+ // Don't know why sometimes even resultsForUpdates is empty, the method won't return;
1878+ token = resultsForUpdates . Select ( r => r . Token ) . Distinct ( ) . SingleOrDefault ( ) ;
1879+ }
18701880 }
18711881#if DEBUG
18721882 catch
You can’t perform that action at this time.
0 commit comments