Skip to content

Commit

Permalink
Move wait to end to avoid outputting a message if cancellation is req…
Browse files Browse the repository at this point in the history
…uested whilst waiting
  • Loading branch information
JakeYallop committed May 24, 2024
1 parent 6c2e257 commit 56085ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions WaybackDownloader/Ui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ public async Task DrawUiAsync(CancellationToken cancellationToken)
private static readonly Style NumberStyle = new(Color.Aqua, Color.Black);
private async Task LogStatsAsync(CancellationToken cancellationToken)
{
await Task.Delay(3000, default).ConfigureAwait(false);
while (!cancellationToken.IsCancellationRequested)
{
await Task.Delay(3000, default).ConfigureAwait(false);

var filesWritten = Counters.FilesWritten.Count;
var filesSkipped = Counters.FilesSkipped.Count;
var filesUpdated = Counters.FilesUpdated.Count;
Expand All @@ -59,6 +58,8 @@ private async Task LogStatsAsync(CancellationToken cancellationToken)
p.Append(filesUpdated.ToString(CultureInfo.CurrentCulture), NumberStyle);
p.Append(Environment.NewLine);
_console.Write(p);

await Task.Delay(3000, default).ConfigureAwait(false);
}
}

Expand Down

0 comments on commit 56085ad

Please sign in to comment.