Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Azure/go-autorest
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: autorest/v0.11.18
Choose a base ref
...
head repository: Azure/go-autorest
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: autorest/v0.11.19
Choose a head ref
  • 4 commits
  • 8 files changed
  • 5 contributors

Commits on May 26, 2021

  1. Add suffix information for additional database services in Azure envi…

    …ronment. (#631)
    
    - MariaDB
    - MySQL
    - Postgresql
    
    Co-authored-by: Ryan Branche <rbranche@apple.com>
    rbranche and Ryan Branche authored May 26, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    c289830 View commit details

Commits on May 27, 2021

  1. add some logging for LROs (#633)

    fixed some logging statements missing new-lines
    jhendrixMSFT authored May 27, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    82fc42f View commit details

Commits on Jun 1, 2021

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    41c23d2 View commit details

Commits on Jun 2, 2021

  1. Changing default polling interval from 60 to 30 (#621)

    Proposing this change following email discussion on making it less conservative. What do you think of this change?
    
    Now it makes me think, can we update the `DefaultRetryDuration` from 30 seconds to 15 seconds if the change above is fine?
    
    Co-authored-by: Joel Hendrix <jhendrix@microsoft.com>
    madewithsmiles and jhendrixMSFT authored Jun 2, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    10e0b31 View commit details
6 changes: 3 additions & 3 deletions autorest/adal/token.go
Original file line number Diff line number Diff line change
@@ -800,13 +800,13 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource, userAssignedID, iden
}
msiType, endpoint, err := getMSIType()
if err != nil {
logger.Instance.Writef(logger.LogError, "Error determining managed identity environment: %v", err)
logger.Instance.Writef(logger.LogError, "Error determining managed identity environment: %v\n", err)
return nil, err
}
logger.Instance.Writef(logger.LogInfo, "Managed identity environment is %s, endpoint is %s", msiType, endpoint)
logger.Instance.Writef(logger.LogInfo, "Managed identity environment is %s, endpoint is %s\n", msiType, endpoint)
if msiEndpoint != "" {
endpoint = msiEndpoint
logger.Instance.Writef(logger.LogInfo, "Managed identity custom endpoint is %s", endpoint)
logger.Instance.Writef(logger.LogInfo, "Managed identity custom endpoint is %s\n", endpoint)
}
msiEndpointURL, err := url.Parse(endpoint)
if err != nil {
4 changes: 4 additions & 0 deletions autorest/azure/async.go
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ import (
"time"

"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/logger"
"github.com/Azure/go-autorest/tracing"
)

@@ -215,6 +216,7 @@ func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Clien
}
// if the initial response has a Retry-After, sleep for the specified amount of time before starting to poll
if delay, ok := f.GetPollingDelay(); ok {
logger.Instance.Writeln(logger.LogInfo, "WaitForCompletionRef: initial polling delay")
if delayElapsed := autorest.DelayForBackoff(delay, 0, cancelCtx.Done()); !delayElapsed {
err = cancelCtx.Err()
return
@@ -234,12 +236,14 @@ func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Clien
var ok bool
delay, ok = f.GetPollingDelay()
if !ok {
logger.Instance.Writeln(logger.LogInfo, "WaitForCompletionRef: Using client polling delay")
delay = client.PollingDelay
}
} else {
// there was an error polling for status so perform exponential
// back-off based on the number of attempts using the client's retry
// duration. update attempts after delayAttempt to avoid off-by-one.
logger.Instance.Writef(logger.LogError, "WaitForCompletionRef: %s\n", err)
delayAttempt = attempts
delay = client.RetryDuration
attempts++
2 changes: 1 addition & 1 deletion autorest/azure/azure.go
Original file line number Diff line number Diff line change
@@ -211,7 +211,7 @@ func (r Resource) String() string {
}

// ParseResourceID parses a resource ID into a ResourceDetails struct.
// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-template-functions-resource#return-value-4.
// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/templates/template-functions-resource?tabs=json#resourceid.
func ParseResourceID(resourceID string) (Resource, error) {

const resourceIDPatternText = `(?i)subscriptions/(.+)/resourceGroups/(.+)/providers/(.+?)/(.+?)/(.+)`
30 changes: 25 additions & 5 deletions autorest/azure/environments.go
Original file line number Diff line number Diff line change
@@ -45,6 +45,7 @@ type ResourceIdentifier struct {
Datalake string `json:"datalake"`
Batch string `json:"batch"`
OperationalInsights string `json:"operationalInsights"`
OSSRDBMS string `json:"ossRDBMS"`
Storage string `json:"storage"`
Synapse string `json:"synapse"`
ServiceBus string `json:"serviceBus"`
@@ -64,14 +65,17 @@ type Environment struct {
ServiceBusEndpoint string `json:"serviceBusEndpoint"`
BatchManagementEndpoint string `json:"batchManagementEndpoint"`
StorageEndpointSuffix string `json:"storageEndpointSuffix"`
CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"`
MariaDBDNSSuffix string `json:"mariaDBDNSSuffix"`
MySQLDatabaseDNSSuffix string `json:"mySqlDatabaseDNSSuffix"`
PostgresqlDatabaseDNSSuffix string `json:"postgresqlDatabaseDNSSuffix"`
SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"`
TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"`
KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"`
ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"`
ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"`
ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"`
ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"`
CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"`
TokenAudience string `json:"tokenAudience"`
APIManagementHostNameSuffix string `json:"apiManagementHostNameSuffix"`
SynapseEndpointSuffix string `json:"synapseEndpointSuffix"`
@@ -93,14 +97,17 @@ var (
ServiceBusEndpoint: "https://servicebus.windows.net/",
BatchManagementEndpoint: "https://batch.core.windows.net/",
StorageEndpointSuffix: "core.windows.net",
CosmosDBDNSSuffix: "documents.azure.com",
MariaDBDNSSuffix: "mariadb.database.azure.com",
MySQLDatabaseDNSSuffix: "mysql.database.azure.com",
PostgresqlDatabaseDNSSuffix: "postgres.database.azure.com",
SQLDatabaseDNSSuffix: "database.windows.net",
TrafficManagerDNSSuffix: "trafficmanager.net",
KeyVaultDNSSuffix: "vault.azure.net",
ServiceBusEndpointSuffix: "servicebus.windows.net",
ServiceManagementVMDNSSuffix: "cloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.azure.com",
ContainerRegistryDNSSuffix: "azurecr.io",
CosmosDBDNSSuffix: "documents.azure.com",
TokenAudience: "https://management.azure.com/",
APIManagementHostNameSuffix: "azure-api.net",
SynapseEndpointSuffix: "dev.azuresynapse.net",
@@ -110,6 +117,7 @@ var (
Datalake: "https://datalake.azure.net/",
Batch: "https://batch.core.windows.net/",
OperationalInsights: "https://api.loganalytics.io",
OSSRDBMS: "https://ossrdbms-aad.database.windows.net",
Storage: "https://storage.azure.com/",
Synapse: "https://dev.azuresynapse.net",
ServiceBus: "https://servicebus.azure.net/",
@@ -130,14 +138,17 @@ var (
ServiceBusEndpoint: "https://servicebus.usgovcloudapi.net/",
BatchManagementEndpoint: "https://batch.core.usgovcloudapi.net/",
StorageEndpointSuffix: "core.usgovcloudapi.net",
CosmosDBDNSSuffix: "documents.azure.us",
MariaDBDNSSuffix: "mariadb.database.usgovcloudapi.net",
MySQLDatabaseDNSSuffix: "mysql.database.usgovcloudapi.net",
PostgresqlDatabaseDNSSuffix: "postgres.database.usgovcloudapi.net",
SQLDatabaseDNSSuffix: "database.usgovcloudapi.net",
TrafficManagerDNSSuffix: "usgovtrafficmanager.net",
KeyVaultDNSSuffix: "vault.usgovcloudapi.net",
ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net",
ServiceManagementVMDNSSuffix: "usgovcloudapp.net",
ResourceManagerVMDNSSuffix: "cloudapp.usgovcloudapi.net",
ContainerRegistryDNSSuffix: "azurecr.us",
CosmosDBDNSSuffix: "documents.azure.us",
TokenAudience: "https://management.usgovcloudapi.net/",
APIManagementHostNameSuffix: "azure-api.us",
SynapseEndpointSuffix: NotAvailable,
@@ -147,6 +158,7 @@ var (
Datalake: NotAvailable,
Batch: "https://batch.core.usgovcloudapi.net/",
OperationalInsights: "https://api.loganalytics.us",
OSSRDBMS: "https://ossrdbms-aad.database.usgovcloudapi.net",
Storage: "https://storage.azure.com/",
Synapse: NotAvailable,
ServiceBus: "https://servicebus.azure.net/",
@@ -167,14 +179,17 @@ var (
ServiceBusEndpoint: "https://servicebus.chinacloudapi.cn/",
BatchManagementEndpoint: "https://batch.chinacloudapi.cn/",
StorageEndpointSuffix: "core.chinacloudapi.cn",
CosmosDBDNSSuffix: "documents.azure.cn",
MariaDBDNSSuffix: "mariadb.database.chinacloudapi.cn",
MySQLDatabaseDNSSuffix: "mysql.database.chinacloudapi.cn",
PostgresqlDatabaseDNSSuffix: "postgres.database.chinacloudapi.cn",
SQLDatabaseDNSSuffix: "database.chinacloudapi.cn",
TrafficManagerDNSSuffix: "trafficmanager.cn",
KeyVaultDNSSuffix: "vault.azure.cn",
ServiceBusEndpointSuffix: "servicebus.chinacloudapi.cn",
ServiceManagementVMDNSSuffix: "chinacloudapp.cn",
ResourceManagerVMDNSSuffix: "cloudapp.chinacloudapi.cn",
ContainerRegistryDNSSuffix: "azurecr.cn",
CosmosDBDNSSuffix: "documents.azure.cn",
TokenAudience: "https://management.chinacloudapi.cn/",
APIManagementHostNameSuffix: "azure-api.cn",
SynapseEndpointSuffix: "dev.azuresynapse.azure.cn",
@@ -184,6 +199,7 @@ var (
Datalake: NotAvailable,
Batch: "https://batch.chinacloudapi.cn/",
OperationalInsights: NotAvailable,
OSSRDBMS: "https://ossrdbms-aad.database.chinacloudapi.cn",
Storage: "https://storage.azure.com/",
Synapse: "https://dev.azuresynapse.net",
ServiceBus: "https://servicebus.azure.net/",
@@ -204,14 +220,17 @@ var (
ServiceBusEndpoint: "https://servicebus.cloudapi.de/",
BatchManagementEndpoint: "https://batch.cloudapi.de/",
StorageEndpointSuffix: "core.cloudapi.de",
CosmosDBDNSSuffix: "documents.microsoftazure.de",
MariaDBDNSSuffix: "mariadb.database.cloudapi.de",
MySQLDatabaseDNSSuffix: "mysql.database.cloudapi.de",
PostgresqlDatabaseDNSSuffix: "postgres.database.cloudapi.de",
SQLDatabaseDNSSuffix: "database.cloudapi.de",
TrafficManagerDNSSuffix: "azuretrafficmanager.de",
KeyVaultDNSSuffix: "vault.microsoftazure.de",
ServiceBusEndpointSuffix: "servicebus.cloudapi.de",
ServiceManagementVMDNSSuffix: "azurecloudapp.de",
ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de",
ContainerRegistryDNSSuffix: NotAvailable,
CosmosDBDNSSuffix: "documents.microsoftazure.de",
TokenAudience: "https://management.microsoftazure.de/",
APIManagementHostNameSuffix: NotAvailable,
SynapseEndpointSuffix: NotAvailable,
@@ -221,6 +240,7 @@ var (
Datalake: NotAvailable,
Batch: "https://batch.cloudapi.de/",
OperationalInsights: NotAvailable,
OSSRDBMS: "https://ossrdbms-aad.database.cloudapi.de",
Storage: "https://storage.azure.com/",
Synapse: NotAvailable,
ServiceBus: "https://servicebus.azure.net/",
48 changes: 47 additions & 1 deletion autorest/azure/environments_test.go
Original file line number Diff line number Diff line change
@@ -33,6 +33,7 @@ const (
graphResourceID = "--graph-resource-id--"
keyvaultResourceID = "--keyvault-resource-id--"
opInsightsResourceID = "--operational-insights-resource-id--"
ossRDBMSResourceID = "--oss-rdbms-resource-id--"
)

// This correlates to the expected contents of ./testdata/test_environment_1.json
@@ -47,6 +48,10 @@ var testEnvironment1 = Environment{
KeyVaultEndpoint: "--key-vault--endpoint--",
GraphEndpoint: "--graph-endpoint--",
StorageEndpointSuffix: "--storage-endpoint-suffix--",
CosmosDBDNSSuffix: "--cosmos-db-dns-suffix--",
MariaDBDNSSuffix: "--maria-db-dns-suffix--",
MySQLDatabaseDNSSuffix: "--mysql-database-dns-suffix--",
PostgresqlDatabaseDNSSuffix: "--postgresql-database-dns-suffix--",
SQLDatabaseDNSSuffix: "--sql-database-dns-suffix--",
TrafficManagerDNSSuffix: "--traffic-manager-dns-suffix--",
KeyVaultDNSSuffix: "--key-vault-dns-suffix--",
@@ -61,6 +66,7 @@ var testEnvironment1 = Environment{
Graph: graphResourceID,
KeyVault: keyvaultResourceID,
OperationalInsights: opInsightsResourceID,
OSSRDBMS: ossRDBMSResourceID,
},
}

@@ -206,6 +212,10 @@ func TestDeserializeEnvironment(t *testing.T) {
"resourceManagerEndpoint": "--resource-manager-endpoint--",
"serviceBusEndpointSuffix": "--service-bus-endpoint-suffix--",
"serviceManagementEndpoint": "--service-management-endpoint--",
"cosmosDBDNSSuffix": "--cosmos-db-dns-suffix--",
"mariaDBDNSSuffix": "--maria-db-dns-suffix--",
"mySqlDatabaseDNSSuffix": "--mysql-database-dns-suffix--",
"postgresqlDatabaseDNSSuffix": "--postgresql-database-dns-suffix--",
"sqlDatabaseDNSSuffix": "--sql-database-dns-suffix--",
"storageEndpointSuffix": "--storage-endpoint-suffix--",
"trafficManagerDNSSuffix": "--traffic-manager-dns-suffix--",
@@ -217,7 +227,8 @@ func TestDeserializeEnvironment(t *testing.T) {
"datalake": "` + datalakeResourceID + `",
"graph": "` + graphResourceID + `",
"keyVault": "` + keyvaultResourceID + `",
"operationalInsights": "` + opInsightsResourceID + `"
"operationalInsights": "` + opInsightsResourceID + `",
"ossRDBMS": "` + ossRDBMSResourceID + `"
}
}`

@@ -260,6 +271,18 @@ func TestDeserializeEnvironment(t *testing.T) {
if "--storage-endpoint-suffix--" != testSubject.StorageEndpointSuffix {
t.Errorf("Expected StorageEndpointSuffix to be \"--storage-endpoint-suffix--\", but got %q", testSubject.StorageEndpointSuffix)
}
if "--cosmos-db-dns-suffix--" != testSubject.CosmosDBDNSSuffix {
t.Errorf("Expected cosmos-db-dns-suffix to be \"--cosmos-db-dns-suffix--\", but got %q", testSubject.CosmosDBDNSSuffix)
}
if "--maria-db-dns-suffix--" != testSubject.MariaDBDNSSuffix {
t.Errorf("Expected maria-db-dns-suffix to be \"--maria-db-dns-suffix--\", but got %q", testSubject.MariaDBDNSSuffix)
}
if "--mysql-database-dns-suffix--" != testSubject.MySQLDatabaseDNSSuffix {
t.Errorf("Expected mysql-database-dns-suffix to be \"--mysql-database-dns-suffix--\", but got %q", testSubject.MySQLDatabaseDNSSuffix)
}
if "--postgresql-database-dns-suffix--" != testSubject.PostgresqlDatabaseDNSSuffix {
t.Errorf("Expected postgresql-database-dns-suffix to be \"--postgresql-database-dns-suffix--\", but got %q", testSubject.PostgresqlDatabaseDNSSuffix)
}
if "--sql-database-dns-suffix--" != testSubject.SQLDatabaseDNSSuffix {
t.Errorf("Expected sql-database-dns-suffix to be \"--sql-database-dns-suffix--\", but got %q", testSubject.SQLDatabaseDNSSuffix)
}
@@ -293,6 +316,9 @@ func TestDeserializeEnvironment(t *testing.T) {
if opInsightsResourceID != testSubject.ResourceIdentifiers.OperationalInsights {
t.Errorf("Expected ResourceIdentifiers.OperationalInsights to be "+opInsightsResourceID+", but got %q", testSubject.ResourceIdentifiers.OperationalInsights)
}
if ossRDBMSResourceID != testSubject.ResourceIdentifiers.OSSRDBMS {
t.Errorf("Expected ResourceIdentifiers.OperationalInsights to be "+ossRDBMSResourceID+", but got %q", testSubject.ResourceIdentifiers.OSSRDBMS)
}
}

func TestRoundTripSerialization(t *testing.T) {
@@ -308,6 +334,10 @@ func TestRoundTripSerialization(t *testing.T) {
GraphEndpoint: "--graph-endpoint--",
ServiceBusEndpoint: "--service-bus-endpoint--",
StorageEndpointSuffix: "--storage-endpoint-suffix--",
CosmosDBDNSSuffix: "--cosmos-db-dns-suffix--",
MariaDBDNSSuffix: "--maria-db-dns-suffix--",
MySQLDatabaseDNSSuffix: "--mysql-database-dns-suffix--",
PostgresqlDatabaseDNSSuffix: "--postgresql-database-dns-suffix--",
SQLDatabaseDNSSuffix: "--sql-database-dns-suffix--",
TrafficManagerDNSSuffix: "--traffic-manager-dns-suffix--",
KeyVaultDNSSuffix: "--key-vault-dns-suffix--",
@@ -321,6 +351,7 @@ func TestRoundTripSerialization(t *testing.T) {
Graph: graphResourceID,
KeyVault: keyvaultResourceID,
OperationalInsights: opInsightsResourceID,
OSSRDBMS: ossRDBMSResourceID,
},
}

@@ -368,6 +399,18 @@ func TestRoundTripSerialization(t *testing.T) {
if env.StorageEndpointSuffix != testSubject.StorageEndpointSuffix {
t.Errorf("Expected StorageEndpointSuffix to be %q, but got %q", env.StorageEndpointSuffix, testSubject.StorageEndpointSuffix)
}
if env.CosmosDBDNSSuffix != testSubject.CosmosDBDNSSuffix {
t.Errorf("Expected CosmosDBDNSSuffix to be %q, but got %q", env.CosmosDBDNSSuffix, testSubject.CosmosDBDNSSuffix)
}
if env.MariaDBDNSSuffix != testSubject.MariaDBDNSSuffix {
t.Errorf("Expected MariaDBDNSSuffix to be %q, but got %q", env.MariaDBDNSSuffix, testSubject.MariaDBDNSSuffix)
}
if env.MySQLDatabaseDNSSuffix != testSubject.MySQLDatabaseDNSSuffix {
t.Errorf("Expected MySQLDatabaseDNSSuffix to be %q, but got %q", env.MySQLDatabaseDNSSuffix, testSubject.MySQLDatabaseDNSSuffix)
}
if env.PostgresqlDatabaseDNSSuffix != testSubject.PostgresqlDatabaseDNSSuffix {
t.Errorf("Expected PostgresqlDatabaseDNSSuffix to be %q, but got %q", env.PostgresqlDatabaseDNSSuffix, testSubject.PostgresqlDatabaseDNSSuffix)
}
if env.SQLDatabaseDNSSuffix != testSubject.SQLDatabaseDNSSuffix {
t.Errorf("Expected SQLDatabaseDNSSuffix to be %q, but got %q", env.SQLDatabaseDNSSuffix, testSubject.SQLDatabaseDNSSuffix)
}
@@ -404,6 +447,9 @@ func TestRoundTripSerialization(t *testing.T) {
if env.ResourceIdentifiers.OperationalInsights != testSubject.ResourceIdentifiers.OperationalInsights {
t.Errorf("Expected ResourceIdentifiers.OperationalInsights to be %q, but got %q", env.ResourceIdentifiers.OperationalInsights, testSubject.ResourceIdentifiers.OperationalInsights)
}
if env.ResourceIdentifiers.OSSRDBMS != testSubject.ResourceIdentifiers.OSSRDBMS {
t.Errorf("Expected ResourceIdentifiers.OSSRDBMS to be %q, but got %q", env.ResourceIdentifiers.OSSRDBMS, testSubject.ResourceIdentifiers.OSSRDBMS)
}
}

func TestSetEnvironment(t *testing.T) {
7 changes: 6 additions & 1 deletion autorest/azure/testdata/test_environment_1.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,10 @@
"keyVaultEndpoint": "--key-vault--endpoint--",
"graphEndpoint": "--graph-endpoint--",
"storageEndpointSuffix": "--storage-endpoint-suffix--",
"cosmosDBDNSSuffix": "--cosmos-db-dns-suffix--",
"mariaDBDNSSuffix": "--maria-db-dns-suffix--",
"mySqlDatabaseDNSSuffix": "--mysql-database-dns-suffix--",
"postgresqlDatabaseDNSSuffix": "--postgresql-database-dns-suffix--",
"sqlDatabaseDNSSuffix": "--sql-database-dns-suffix--",
"trafficManagerDNSSuffix": "--traffic-manager-dns-suffix--",
"keyVaultDNSSuffix": "--key-vault-dns-suffix--",
@@ -22,6 +26,7 @@
"datalake": "--datalake-resource-id--",
"graph": "--graph-resource-id--",
"keyVault": "--keyvault-resource-id--",
"operationalInsights": "--operational-insights-resource-id--"
"operationalInsights": "--operational-insights-resource-id--",
"ossRDBMS": "--oss-rdbms-resource-id--"
}
}
2 changes: 1 addition & 1 deletion autorest/client.go
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ import (

const (
// DefaultPollingDelay is a reasonable delay between polling requests.
DefaultPollingDelay = 60 * time.Second
DefaultPollingDelay = 30 * time.Second

// DefaultPollingDuration is a reasonable total polling duration.
DefaultPollingDuration = 15 * time.Minute
2 changes: 2 additions & 0 deletions autorest/sender.go
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@ import (
"sync"
"time"

"github.com/Azure/go-autorest/logger"
"github.com/Azure/go-autorest/tracing"
)

@@ -438,6 +439,7 @@ func DelayForBackoffWithCap(backoff, cap time.Duration, attempt int, cancel <-ch
if cap > 0 && d > cap {
d = cap
}
logger.Instance.Writef(logger.LogInfo, "DelayForBackoffWithCap: sleeping for %s\n", d)
select {
case <-time.After(d):
return true