Skip to content

Delay progress bar in Copy-Item and Remove-Item cmdlets - #24013

Merged
Ilya (iSazonov) merged 10 commits into
PowerShell:masterfrom
TheSpyGod:master
Aug 20, 2024
Merged

Ilya (iSazonov) merged 10 commits into
PowerShell:masterfrom
TheSpyGod:master

Conversation

@TheSpyGod

Copy link
Copy Markdown
Contributor

PR Summary

I've optimized the Progress Bar of the Copy and Remove commands to display only after the operation lasts more then 200ms, otherwise do the operation without a Progress Bar, I've done this by adding to the IF conditional of IF _copyStopwatch or _removeStopwatch Elapsed time is higher then 0.2 seconds(200ms) add the Progress Bar to the process.

PR Context

Fix #23831

PR Checklist

SpyGod and others added 4 commits July 3, 2024 22:30
I intend to remove the progressbar for less then or equal to 5 file, to make it less anoying TODO: Check for errors when running Remove-Item
Made it so that the progress bar for removing only appears after the _removeStopwatch reaches 600ms
Made the copy and remove command display the Progress bar only after the process is lasting more then 200ms
SpyGod and others added 2 commits July 5, 2024 14:29
…econds

Made it so that instead of skipping it all together, only the instance will not be shown until 3 seconds elapse, the calculations will still continue
Changed the Creating of the Progress Bar's instance to be after 3 seconds
SpyGod and others added 2 commits July 5, 2024 19:41
Fixed Indentation for IF as Guidelines Say and Switched the Duration const to PascalCase
Fixed Indentation, Removed Empty Spaces, and Switched Const to PascalCase
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Review - Needed The PR is being reviewed label Jul 13, 2024
@microsoft-github-policy-service microsoft-github-policy-service Bot added Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept and removed Review - Needed The PR is being reviewed labels Aug 5, 2024
@SteveL-MSFT

Copy link
Copy Markdown
Member

TheSpyGod if you don't want to agree to the CLA, I'll submit a new PR to address this

@SteveL-MSFT Steve Lee (SteveL-MSFT) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the indentation issue

@TheSpyGod

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@microsoft-github-policy-service microsoft-github-policy-service Bot removed the Waiting on Author The PR was reviewed and requires changes or comments from the author before being accept label Aug 13, 2024
@SteveL-MSFT

Copy link
Copy Markdown
Member

Ilya (@iSazonov) can you take another look? I've pushed changes you've requested as I'd like to get this into 7.5 as it annoys me when doing small copies/removes. I've also reduced the threshold to 2 secs intead of 3. After building the branch privately, 3 secs seems way too long.

@iSazonov Ilya (iSazonov) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Aug 20, 2024

@iSazonov Ilya (iSazonov) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steve Lee (@SteveL-MSFT)

ProgressBarDurationThreshold = 2.0;

Classic definition for interactive scenarios is 5 - 15 seconds. My personal preference is gold middle 10s for the constant. (Something like Exchange Server PowerShell console does.) Otherwise I expect users will see flapped lines. Nevertheless I merge the PR so we get early feedback and adjust the constant before release.

@iSazonov Ilya (iSazonov) changed the title Optimized Progress Bar, Displays based on Operation Duration Delay progress bar in Copy-Item and Remove-Item cmdlets Aug 20, 2024
@iSazonov
Ilya (iSazonov) merged commit be59e5e into PowerShell:master Aug 20, 2024
@microsoft-github-policy-service

microsoft-github-policy-service Bot commented Aug 20, 2024 •

Copy link
Copy Markdown
Contributor

📣 Hey TheSpyGod, how did we do? We would love to hear your feedback with the link below! 🗣️

🔗 https://aka.ms/PSRepoFeedback

@iSazonov

Copy link
Copy Markdown
Collaborator

TheSpyGod Thanks for your contribution.

@kilasuit

Copy link
Copy Markdown
Collaborator

This PR seems to have fixed #25679 and like Steve Lee (@SteveL-MSFT) mentions needs backporting to 7.5.x releases
Though can we be sure the issue in #25679 wouldn't just reoccur with a longer duration at all?

Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove-Item progress should only be displayed if > 5 items

4 participants