Repository navigation
PowerShellForGitHub: Suggest Disabling ProgressBar when Calling Invoke-WebRequest #227
Description
Activity
- addedbugThis relates to a bug in the existing module.This relates to a bug in the existing module.triage neededAn issue that needs to be reviewed by a member of the team.An issue that needs to be reviewed by a member of the team.
on Jun 8, 2020 HowardWolosky commented
on Jun 8, 2020 ContributorMore actionsInteresting. Very interesting. Thanks for the background.
I agree that based on that thread, we should consider a change.
That thread also points out that the issue was fixed in PS 7 (which your repro also confirms), so I don't want all users to lose out on potentially helpful status information, simply because of an issue in the earlier platform.
So...my thought is to add a new configuration property:
EnableWebRequestStatus(or something similar). It can default tofalse. But then users can choose to re-enable it if they so choose (either because they're on PS5 and don't care about the performance hit, or because they're on PS7 and don't have a performance hit to worry about).The one thing to keep in mind when implementing a config property read within
Invoke-GHRestMethodis that you need to pass-in the config property as a parameter to thescriptblock. Don't read it directly within thescriptblock. This is mainly because someone can change the value as-SessionOnlyto impact the current PS session, but thescriptblockwill actually be a separate session that we need to treat as the same one as far as configurations are concerned.Approving the suggestion, and marking it as
in progresssince you want to take it on.- addedin progressWork on this issue is already underway. Please don't work start new work on it.Work on this issue is already underway. Please don't work start new work on it.and removedtriage neededAn issue that needs to be reviewed by a member of the team.An issue that needs to be reviewed by a member of the team.
on Jun 8, 2020 X-Guardian commented
on Jun 8, 2020 ContributorAuthorMore actionsAre you sure that is not over-engineering the solution? If you have
Statusenabled, you don't even see theInvoke-WebRequestprogress, as it is within a job. If you haveStatusdisabled, you didn't want status, so perhaps we shouldn't show any?HowardWolosky commented
on Jun 8, 2020 ContributorMore actionsYou raise great points. Agreed. Forget the new config property, and proceed as you initially described. Thanks!
- added a commit that references this issue
on Jun 10, 2020
Issue Details
It is a known issue that the speed of
Invoke-WebRequestis affected badly by displaying the progress bar, especially for larger transfers in PowerShell 5. See Progress bar can significantly impact cmdlet performance.It is suggested to disable the progress bar for
Invoke-WebRequestto improve the speed of the Pester tests and also general module performance. This would also remove progress bar 'flickering' when usingNoStatus.Steps to reproduce the issue
Results
Suggested solution to the issue
Add the following lines before both
Invoke-WebRequestcalls in theInvoke-GHRestMethodfunction:and the following line after both calls:
This change has no affect on the Status progress bar.
Requested Assignment
Operating System
PowerShell Version
Module Version
Running: 0.14.0
Installed: 0.14.0