Skip to content

Commit

Permalink
Smooth progress for delay step
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Sep 20, 2024
1 parent 54b545d commit 9016cb0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Refresher.Core/Pipelines/Steps/DelayOneSecondStep.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics;

namespace Refresher.Core.Pipelines.Steps;

public class DelayOneSecondStep : Step
Expand All @@ -10,6 +12,11 @@ public DelayOneSecondStep(Pipeline pipeline) : base(pipeline)

public override async Task ExecuteAsync(CancellationToken cancellationToken = default)
{
await Task.Delay(1000, cancellationToken);
Stopwatch stopwatch = Stopwatch.StartNew();
while (stopwatch.ElapsedMilliseconds <= 1000)
{
this.Progress = stopwatch.ElapsedMilliseconds / 1000.0f;
await Task.Delay(10, cancellationToken);
}
}
}

0 comments on commit 9016cb0

Please sign in to comment.