Skip to content

Commit 2740026

Browse files
Reimagining status for the module (#253)
* Reimagining status for the module Status for commands was originally added to this module based on my experience with other REST API's where individual commands could easily take 10-20 seconds. Practical usage has shown that most GitHub requests in reality take under one second. The additional work that PowerShell has to do in order to display progress to the user can easily make the overall command take 4-6 times longer than its actual execution time. Therefore, status is being ripped out of this module (for the most part). `Invoke-GHRestMethod` and `Invoke-SendTelemetryEvent` no longer have bifurcating execution paths based on the value of `$NoStatus`. Everything runs synchronously now on the command prompt. * `DefaultNoStatus` has been deprecated. Its value will be ignored. * The `NoStatus` switch has not been removed from the module commands in order to avoid a breaking change. It may be removed in a future update. * `Invoke-GHRestMethod -ExtendedResult` has been updated to include the next page's number and the total number of pages for the REST request. * A new configuration value has been added: `MultiRequestProgressThreshold `Invoke-GHRestMethodMultipleResult` will display a ProgressBar to the user tracking the number of remaining requests for the overall execution of the requested command based on this threshold value. It will only display the progress bar if the number of requets needed meets or exceeds this threshold value. This defaults to 10, and can be disabled with a value of 0. Practical usage has shown that this adds less than a second of additional time to the overall execution of a multi-request command (quite different than the previous status). * `Wait-JobWithAnimation` has been removed since it's no longer used. Fixes #247
1 parent f31d791 commit 2740026

File tree

6 files changed

+138
-482
lines changed

6 files changed

+138
-482
lines changed

GitHubConfiguration.ps1

+16
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ function Set-GitHubConfiguration
7878
7979
.PARAMETER DefaultNoStatus
8080
Control if the -NoStatus switch should be passed-in by default to all methods.
81+
The -NoStatus switch has been deprecated. Commands in this module no longer display status
82+
on the console, thus passing in -NoStatus to a command no longer has any impact.
83+
Therefore, the value of this configuration setting also no longer has any impact on
84+
command execution.
8185
8286
.PARAMETER DefaultOwnerName
8387
The owner name that should be used with a command that takes OwnerName as a parameter
@@ -132,6 +136,14 @@ function Set-GitHubConfiguration
132136
.PARAMETER LogTimeAsUtc
133137
If specified, all times logged will be logged as UTC instead of the local timezone.
134138
139+
.PARAMETER MultiRequestProgressThreshold
140+
Some commands may require sending multiple requests to GitHub. In some situations,
141+
getting the entirety of the request might take 70+ requests occurring over 20+ seconds.
142+
A progress bar will be shown (displaying which sub-request is being executed) if the number
143+
of requests required to complete this command is greater than or equal to this configuration
144+
value.
145+
Set to 0 to disable this feature.
146+
135147
.PARAMETER RetryDelaySeconds
136148
The number of seconds to wait before retrying a command again after receiving a 202 response.
137149
@@ -212,6 +224,8 @@ function Set-GitHubConfiguration
212224

213225
[switch] $LogTimeAsUtc,
214226

227+
[int] $MultiRequestProgressThreshold,
228+
215229
[int] $RetryDelaySeconds,
216230

217231
[switch] $SuppressNoTokenWarning,
@@ -296,6 +310,7 @@ function Get-GitHubConfiguration
296310
'LogProcessId',
297311
'LogRequestBody',
298312
'LogTimeAsUtc',
313+
'MultiRequestProgressThreshold',
299314
'RetryDelaySeconds',
300315
'SuppressNoTokenWarning',
301316
'SuppressTelemetryReminder',
@@ -640,6 +655,7 @@ function Import-GitHubConfiguration
640655
'logProcessId' = $false
641656
'logRequestBody' = $false
642657
'logTimeAsUtc' = $false
658+
'multiRequestProgressThreshold' = 10
643659
'retryDelaySeconds' = 30
644660
'suppressNoTokenWarning' = $false
645661
'suppressTelemetryReminder' = $false

0 commit comments

Comments
 (0)