mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 13:36:50 +01:00
Setting the Stage of a JobProgressReporter now updates progress instantly
This commit is contained in:
@@ -14,7 +14,18 @@ namespace Tgstation.Server.Host.Jobs
|
||||
/// <summary>
|
||||
/// The name of the current stage.
|
||||
/// </summary>
|
||||
public string StageName { get; set; }
|
||||
public string StageName
|
||||
{
|
||||
get => stageName;
|
||||
set
|
||||
{
|
||||
if (stageName == value)
|
||||
return;
|
||||
|
||||
stageName = value;
|
||||
callback(stageName, lastProgress);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="ILogger{TCategoryName}"/> for the <see cref="JobProgressReporter"/>.
|
||||
@@ -26,6 +37,16 @@ namespace Tgstation.Server.Host.Jobs
|
||||
/// </summary>
|
||||
readonly Action<string, double?> callback;
|
||||
|
||||
/// <summary>
|
||||
/// Backing field for <see cref="StageName"/>.
|
||||
/// </summary>
|
||||
string stageName;
|
||||
|
||||
/// <summary>
|
||||
/// The last progress value pushed into the <see cref="callback"/>.
|
||||
/// </summary>
|
||||
double? lastProgress;
|
||||
|
||||
/// <summary>
|
||||
/// The total progress reported so far in this section.
|
||||
/// </summary>
|
||||
@@ -66,6 +87,7 @@ namespace Tgstation.Server.Host.Jobs
|
||||
sectionProgression = progress.Value;
|
||||
|
||||
callback(StageName, clampedProgress);
|
||||
lastProgress = clampedProgress;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user