File tree 1 file changed +13
-3
lines changed 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,8 @@ async Task UpdateActionAsync()
212
212
await Task . Delay ( 20 ) ;
213
213
while ( channelReader . TryRead ( out var item ) )
214
214
{
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 )
216
217
queue [ item . ID ] = item ;
217
218
}
218
219
@@ -1861,12 +1862,21 @@ public void UpdateResultView(ICollection<ResultsForUpdate> resultsForUpdates)
1861
1862
{
1862
1863
if ( ! resultsForUpdates . Any ( ) )
1863
1864
return ;
1865
+
1864
1866
CancellationToken token ;
1865
1867
1866
1868
try
1867
1869
{
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
+ }
1870
1880
}
1871
1881
#if DEBUG
1872
1882
catch
You can’t perform that action at this time.
0 commit comments