Skip to content

Commit 2ca3c76

Browse files
authored
Refresh Progress Task at 1 second intervals (#456)
* Refresh Progress Task at 1 second intervals * Formatting Markdown --------- Co-authored-by: Tom Longhurst <[email protected]>
1 parent 3f13193 commit 2ca3c76

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ Define your pipeline in .NET! Strong types, intellisense, parallelisation, and t
6363
| ModularPipelines.WinGet | Helpers for interacting with the Windows Package Manager. | [![nuget](https://img.shields.io/nuget/v/ModularPipelines.WinGet.svg)](https://www.nuget.org/packages/ModularPipelines.WinGet/) |
6464
| ModularPipelines.Yarn | Helpers for interacting with Yarn CLI. | [![nuget](https://img.shields.io/nuget/v/ModularPipelines.Yarn.svg)](https://www.nuget.org/packages/ModularPipelines.Yarn/) |
6565

66-
6766
## Getting Started
6867

6968
If you want to see how to get started, or want to know more about ModularPipelines, [read the Documentation here](https://thomhurst.github.io/ModularPipelines)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
null

src/ModularPipelines/Helpers/ProgressPrinter.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public Task PrintProgress(OrganizedModules organizedModules, CancellationToken c
5050
return;
5151
}
5252

53-
await Task.Delay(100, CancellationToken.None);
53+
await Task.Delay(TimeSpan.FromSeconds(1), CancellationToken.None);
5454
}
5555

5656
if (cancellationToken.IsCancellationRequested)
@@ -170,12 +170,12 @@ private static void RegisterModules(IReadOnlyList<RunnableModule> modulesToProce
170170

171171
var totalEstimatedSeconds = estimatedDuration.TotalSeconds >= 1 ? estimatedDuration.TotalSeconds : 1;
172172

173-
var ticksPerSecond = 1000 / totalEstimatedSeconds;
173+
var ticksPerSecond = 100 / totalEstimatedSeconds;
174174

175175
progressTask.Description = moduleName;
176176
while (progressTask is { IsFinished: false, Value: < 95 })
177177
{
178-
await Task.Delay(TimeSpan.FromMilliseconds(100), CancellationToken.None);
178+
await Task.Delay(TimeSpan.FromSeconds(1), CancellationToken.None);
179179
progressTask.Increment(ticksPerSecond);
180180
}
181181
}, cancellationToken);
@@ -264,11 +264,11 @@ private static void RegisterSubModules(RunnableModule moduleToProcess, ProgressC
264264

265265
var totalEstimatedSeconds = estimatedDuration.TotalSeconds >= 1 ? estimatedDuration.TotalSeconds : 1;
266266

267-
var ticksPerSecond = 1000 / totalEstimatedSeconds;
267+
var ticksPerSecond = 100 / totalEstimatedSeconds;
268268

269269
while (progressTask is { IsFinished: false, Value: < 95 })
270270
{
271-
await Task.Delay(TimeSpan.FromMilliseconds(100), CancellationToken.None);
271+
await Task.Delay(TimeSpan.FromSeconds(1), CancellationToken.None);
272272
progressTask.Increment(ticksPerSecond);
273273
}
274274
}, cancellationToken);

0 commit comments

Comments
 (0)