Fix progress bar stacking when removing items#27675
Open
kborowinski wants to merge 1 commit into
Open
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
5 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts Remove-Item progress completion logic in FileSystemProvider to prevent stale progress activities (and stacked progress bars) when concurrent total-file counting lags behind removal and the removed count surpasses the initially computed total.
Changes:
- Updates the completion condition for the
Remove-Itemprogress activity from==to>=so completion is emitted even when_removedFilesexceeds_totalFiles.
| } | ||
|
|
||
| if (Stopping || _removedFiles == _totalFiles) | ||
| if (Stopping || _removedFiles >= _totalFiles) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Fixes the
Remove-Itemprogress bar stacking issue when the number of removed files exceeds the initially calculated total.The file count is calculated concurrently with file removal. Because of this race,
_removedFilescan advance beyond_totalFiles. Requiring both values to be exactly equal prevents the completed progress record from being emitted, leaving the progress bar visible and causing subsequent progress records to stack.This change completes the progress activity when
_removedFilesis greater than or equal to_totalFiles.This PR only fixes the progress bar stacking issue. The total file calculation can still be off by one and is not addressed by this change.
Fixes progress bar stacking only in #23875.
PR Context
Remove-Itemcan report more removed files than the calculated total, for example,Removed 11 of 10 files. In this situation, the existing equality check is never satisfied, so the progress activity remains active after the removal operation completes.Using
>=ensures that the progress record is completed even when concurrent file counting and removal cause the removed-file count to exceed the calculated total. This prevents staleRemove-Itemprogress bars from remaining visible and stacking with later progress output.The underlying off-by-one issue in the total calculation remains and should be addressed separately.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header