Skip to content

Commit b68fc28

Browse files
committed
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 d32bd11 commit b68fc28

File tree

6 files changed

+130
-490
lines changed

6 files changed

+130
-490
lines changed

GitHubConfiguration.ps1

+15
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ 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, and therefore passing in -NoStatus to a command has no effect.
83+
Therefore, the value of this configuration setting has no impact on command execution.
8184
8285
.PARAMETER DefaultOwnerName
8386
The owner name that should be used with a command that takes OwnerName as a parameter
@@ -132,6 +135,14 @@ function Set-GitHubConfiguration
132135
.PARAMETER LogTimeAsUtc
133136
If specified, all times logged will be logged as UTC instead of the local timezone.
134137
138+
.PARAMETER MultiRequestProgressThreshold
139+
Some commands may require sending multiple requests to GitHub. In some situations,
140+
getting the entirety of the request might take 70+ requests occurring over 20+ seconds.
141+
A progress bar will be shown (displaying which sub-request is being executed) if the number
142+
of requests required to complete this command is greater than or equal to this configuration
143+
value.
144+
Set to 0 to disable this feature.
145+
135146
.PARAMETER RetryDelaySeconds
136147
The number of seconds to wait before retrying a command again after receiving a 202 response.
137148
@@ -212,6 +223,8 @@ function Set-GitHubConfiguration
212223

213224
[switch] $LogTimeAsUtc,
214225

226+
[int] $MultiRequestProgressThreshold,
227+
215228
[int] $RetryDelaySeconds,
216229

217230
[switch] $SuppressNoTokenWarning,
@@ -296,6 +309,7 @@ function Get-GitHubConfiguration
296309
'LogProcessId',
297310
'LogRequestBody',
298311
'LogTimeAsUtc',
312+
'MultiRequestProgressThreshold',
299313
'RetryDelaySeconds',
300314
'SuppressNoTokenWarning',
301315
'SuppressTelemetryReminder',
@@ -640,6 +654,7 @@ function Import-GitHubConfiguration
640654
'logProcessId' = $false
641655
'logRequestBody' = $false
642656
'logTimeAsUtc' = $false
657+
'multiRequestProgressThreshold' = 10
643658
'retryDelaySeconds' = 30
644659
'suppressNoTokenWarning' = $false
645660
'suppressTelemetryReminder' = $false

0 commit comments

Comments
 (0)