You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PowerShellForGitHub: Suggest Disabling ProgressBar when Calling Invoke-WebRequest #227
It is suggested to disable the progress bar for Invoke-WebRequest to improve the speed of the Pester tests and also general module performance. This would also remove progress bar 'flickering' when using NoStatus.
Interesting. 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 to false. 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-GHRestMethod is that you need to pass-in the config property as a parameter to the scriptblock. Don't read it directly within the scriptblock. This is mainly because someone can change the value as -SessionOnly to impact the current PS session, but the scriptblock will 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 progress since you want to take it on.
Are you sure that is not over-engineering the solution? If you have Status enabled, you don't even see the Invoke-WebRequest progress, as it is within a job. If you have Status disabled, you didn't want status, so perhaps we shouldn't show any?
Activity
HowardWolosky commentedon Jun 8, 2020
Interesting. 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.X-Guardian commentedon Jun 8, 2020
Are 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 commentedon Jun 8, 2020
You raise great points. Agreed. Forget the new config property, and proceed as you initially described. Thanks!
PowerShellForGitHub: Disable Progress Bar for Invoke-WebRequest (#229)