mirror of
https://github.com/actions/runner.git
synced 2026-01-24 05:21:25 +08:00
fix step duplication
This commit is contained in:
@@ -1770,8 +1770,8 @@ namespace GitHub.Runner.Worker.Dap
|
||||
}
|
||||
|
||||
// Reset the step manipulator to match the restored state
|
||||
// It will be re-initialized when the restored step starts
|
||||
_stepManipulator?.ClearChanges();
|
||||
_stepManipulator?.TrimCompletedSteps(checkpointIndex);
|
||||
|
||||
// Store restored checkpoint for StepsRunner to consume
|
||||
_restoredCheckpoint = checkpoint;
|
||||
|
||||
@@ -114,6 +114,13 @@ namespace GitHub.Runner.Worker.Dap.StepCommands
|
||||
/// </summary>
|
||||
void ClearChanges();
|
||||
|
||||
/// <summary>
|
||||
/// Trims the completed steps list to the specified count.
|
||||
/// Used when restoring a checkpoint to sync state with the debug session.
|
||||
/// </summary>
|
||||
/// <param name="count">The number of completed steps to keep.</param>
|
||||
void TrimCompletedSteps(int count);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a step with the given ID already exists.
|
||||
/// </summary>
|
||||
@@ -576,6 +583,17 @@ namespace GitHub.Runner.Worker.Dap.StepCommands
|
||||
_originalSteps = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void TrimCompletedSteps(int count)
|
||||
{
|
||||
var originalCount = _completedSteps.Count;
|
||||
while (_completedSteps.Count > count)
|
||||
{
|
||||
_completedSteps.RemoveAt(_completedSteps.Count - 1);
|
||||
}
|
||||
Trace.Info($"Trimmed completed steps from {originalCount} to {_completedSteps.Count}");
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool HasStepWithId(string id)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user