Skip to content

Commit 43c516f

Browse files
🐛 Don't Increment Module Progress if it will exceed 100 (#460)
* Update ProgressPrinter.cs * change double and add release notes
1 parent e48bb73 commit 43c516f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix modules appearing as completed (100%) before they had actually completed

src/ModularPipelines/Helpers/ProgressPrinter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ private static void RegisterModules(IReadOnlyList<RunnableModule> modulesToProce
168168
progressTask.StartTask();
169169
var estimatedDuration = moduleToProcess.EstimatedDuration * 1.1; // Give 10% headroom
170170

171-
var totalEstimatedSeconds = estimatedDuration.TotalSeconds >= 1 ? estimatedDuration.TotalSeconds : 1;
171+
var totalEstimatedSeconds = estimatedDuration.TotalSeconds >= 1.0 ? estimatedDuration.TotalSeconds : 1.0;
172172

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

175175
progressTask.Description = moduleName;
176-
while (progressTask is { IsFinished: false, Value: < 95 })
176+
while (progressTask is { IsFinished: false, Value: < 95 } && ticksPerSecond + progressTask.Value < 95)
177177
{
178178
await Task.Delay(TimeSpan.FromSeconds(1), CancellationToken.None);
179179
progressTask.Increment(ticksPerSecond);

0 commit comments

Comments
 (0)