Skip to content

Commit 905a97d

Browse files
committed
Test result clear issue
1 parent 2026bb7 commit 905a97d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ public MainViewModel()
194194
_ = RegisterClockAndDateUpdateAsync();
195195
}
196196

197+
private int cancelIndex = 0;
198+
197199
private void RegisterViewUpdate()
198200
{
199201
var resultUpdateChannel = Channel.CreateUnbounded<ResultsForUpdate>();
@@ -212,6 +214,17 @@ async Task UpdateActionAsync()
212214
await Task.Delay(20);
213215
while (channelReader.TryRead(out var item))
214216
{
217+
if (item.shouldClearExistingResults)
218+
{
219+
cancelIndex++;
220+
if (cancelIndex > 1)
221+
{
222+
// Assume one task for clearing existing results is cancelled
223+
continue;
224+
}
225+
}
226+
227+
215228
if (!item.Token.IsCancellationRequested)
216229
queue[item.ID] = item;
217230
}

0 commit comments

Comments
 (0)