From 71577d1ea3d425b50d3e48f4b10dde217fca36d8 Mon Sep 17 00:00:00 2001 From: Dominion Date: Mon, 24 Apr 2023 18:35:51 -0400 Subject: [PATCH] Setting the Stage of a JobProgressReporter now updates progress instantly --- .../Jobs/JobProgressReporter.cs | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs b/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs index afa250e2aa..4d23385e63 100644 --- a/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs +++ b/src/Tgstation.Server.Host/Jobs/JobProgressReporter.cs @@ -14,7 +14,18 @@ namespace Tgstation.Server.Host.Jobs /// /// The name of the current stage. /// - public string StageName { get; set; } + public string StageName + { + get => stageName; + set + { + if (stageName == value) + return; + + stageName = value; + callback(stageName, lastProgress); + } + } /// /// The for the . @@ -26,6 +37,16 @@ namespace Tgstation.Server.Host.Jobs /// readonly Action callback; + /// + /// Backing field for . + /// + string stageName; + + /// + /// The last progress value pushed into the . + /// + double? lastProgress; + /// /// The total progress reported so far in this section. /// @@ -66,6 +87,7 @@ namespace Tgstation.Server.Host.Jobs sectionProgression = progress.Value; callback(StageName, clampedProgress); + lastProgress = clampedProgress; } ///