Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Documentation/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ values of these variables will be honored if they already exist, otherwise they

**`$global:SBAutoRetryErrorCodes`** - [int[]] Some error status codes indicate that a retry is
likely to be met with success. StoreBroker will use an exponential back-off strategy for
the status codes contained within this list of values. Defaults to `@(429, 503)`.
the status codes contained within this list of values. Defaults to `@()`. Possible useful values:

* `429` - The Submission API limits a Tenant to 20 requests per minute. Any requests exceeding
that will receive this error code until that minute has expired.
Expand Down
56 changes: 50 additions & 6 deletions StoreBroker/StoreIngestionApi.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -128,32 +128,76 @@ function Initialize-StoreIngestionApiGlobalVariables
# SilentlyContinue would cause it to go into the global $Error array, Ignore prevents that as well.
if (!(Get-Variable -Name SBDefaultProxyEndpoint -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBDefaultProxyEndpoint = $null
if ($env:SBDefaultProxyEndpoint)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason not to uses Get-Variable like we do above?

{
$global:SBDefaultProxyEndpoint = [string]$env:SBDefaultProxyEndpoint
}
else
{
$global:SBDefaultProxyEndpoint = $null
}

}

if (!(Get-Variable -Name SBAutoRetryErrorCodes -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBAutoRetryErrorCodes = @()
if ($env:SBAutoRetryErrorCodes)
{
$global:SBAutoRetryErrorCodes = $env:SBAutoRetryErrorCodes.Split(',') | ForEach-Object { [int]$_ }
}
else
{
$global:SBAutoRetryErrorCodes = @()
}
}

if (!(Get-Variable -Name SBGetRequestAutoRetryErrorCodes -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBGetRequestAutoRetryErrorCodes = @(429, 500, 502, 503)
if ($env:SBGetRequestAutoRetryErrorCodes)
{
$global:SBGetRequestAutoRetryErrorCodes = `
$env:SBGetRequestAutoRetryErrorCodes.Split(',') | ForEach-Object { [int]$_ }
}
else
{
$global:SBGetRequestAutoRetryErrorCodes = @(429, 500, 502, 503)
}
}

if (!(Get-Variable -Name SBMaxAutoRetries -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBMaxAutoRetries = 5
if ($env:SBMaxAutoRetries)
{
$global:SBMaxAutoRetries = [int]$env:SBMaxAutoRetries
}
else
{
$global:SBMaxAutoRetries = 5
}
}

if (!(Get-Variable -Name SBStoreBrokerClientName -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBStoreBrokerClientName = $null
if ($env:SBStoreBrokerClientName)
{
$global:SBStoreBrokerClientName = [string]$env:SBStoreBrokerClientName
}
else
{
$global:SBStoreBrokerClientName = $null
}
}

if (!(Get-Variable -Name SBDefaultTransferConnectionLimit -Scope Global -ValueOnly -ErrorAction Ignore))
{
$global:SBDefaultTransferConnectionLimit = [Environment]::ProcessorCount * 8
if ($env:SBDefaultTransferConnectionLimit)
{
$global:SBDefaultTransferConnectionLimit = [int]$env:SBDefaultTransferConnectionLimit
}
else
{
$global:SBDefaultTransferConnectionLimit = [Environment]::ProcessorCount * 8
}
}
}

Expand Down