From cbb8a05d969152d94f3d1257e4a9024aaad05c68 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Sat, 1 Oct 2022 19:16:13 -0400 Subject: [PATCH] Fix DreamMaker progress stages --- .../Components/Deployment/DreamMaker.cs | 13 +++++-------- .../Jobs/JobProgressReporter.cs | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs index 0ee97da7c8..ffb2935ac9 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs @@ -717,13 +717,9 @@ namespace Tgstation.Server.Host.Components.Deployment /// A representing the running operation. async Task ProgressTask(JobProgressReporter progressReporter, TimeSpan? estimatedDuration, CancellationToken cancellationToken) { - if (!estimatedDuration.HasValue) - { - progressReporter.ReportProgress(null); - return; - } - - progressReporter.ReportProgress(0); + var noEstimate = !estimatedDuration.HasValue; + progressReporter.StageName = currentStage; + progressReporter.ReportProgress(noEstimate ? null : 0); var sleepInterval = estimatedDuration.HasValue ? estimatedDuration.Value / 100 : TimeSpan.FromMilliseconds(250); @@ -733,7 +729,8 @@ namespace Tgstation.Server.Host.Components.Deployment for (var iteration = 0; iteration < (estimatedDuration.HasValue ? 99 : Int32.MaxValue); ++iteration) { await Task.Delay(sleepInterval, cancellationToken); - progressReporter.ReportProgress(sleepInterval * (iteration + 1) / estimatedDuration.Value); + progressReporter.StageName = currentStage; + progressReporter.ReportProgress(noEstimate ? null : sleepInterval * (iteration + 1) / estimatedDuration.Value); } } catch (OperationCanceledException) diff --git a/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs b/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs index bf008ead13..70ca0b2bb0 100644 --- a/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs +++ b/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs @@ -14,7 +14,7 @@ namespace Tgstation.Server.Host.Jobs /// /// The name of the current stage. /// - public string StageName { get; } + public string StageName { get; set; } /// /// The for the .